mac git命令行操作 git push pull 逻辑

简介: mac git命令行操作 git push pull 逻辑

安装git

想push到线上的完整流程是

情况1,本地开发好了,想上传到线上的分支,或master

1.在空文件夹git init
2.配置相关参数  name  email origin
3.pull 下来线上的分支代码
4.切换分支
5.合并
6.push

情况2,本地开发好了分支,想上传到线上的分支,并且与线上master合并

1.同情况1上传到线上分支,注意分支名称
2.pull下线上的master,pull下线上的分支,本地切换到master分支  然后进行合并
3.上传到线上master 

操作命令

基础环境配置

git  config —global user.name "shizonghao"
git  config —global user.email "shizonghao@foton.com.cn"

新建git

git init 

远程地址配置

git remote add origin http://10.100.3.123//cadre_service.git

将线上代码pull下来 shizonghao_dev是分支名字 也可以直接写master

#git pull <远程主机名> <远程分支名>:<本地分支名>

git pull origin shizonghao_dev  --rebase

以下并非操作流程,只做功能代码展示

查看当前分支

git branch

切换分支

git checkout shizonghao_dev

查看git 状态,全绿才能进行提交

git status

添加到本地分支

 git add .
或者
git add README.md

提交到缓存

git commit -m "本次添加是用于测试"

分支改名

git branch -m master shizonghao_dev

提交到远程仓库

注意本地与远程分支名称一样才可这样写,可以先将分支改名

 git push origin shizonghao_dev

统计改变


git diff --stat master origin/shizonghao_dev

清楚mac已保存的git密码

相关文章
|
4天前
|
开发工具 git
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
8 1
|
8天前
|
存储 开发工具 git
蓝易云 - git中,add到暂存区,commit且push之后,暂存区域里还有内容吗
所以,当你执行 `git add`,然后是 `git commit`,最后是 `git push`之后,暂存区是空的,除非你又执行了新的 `git add`命令来添加更多的更改。
14 1
|
11天前
|
存储 开发工具 git
解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”
解决“hint: the same ref. If you want to integrate the remote changes, usehint: ‘git pull‘ before pus”
|
11天前
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
|
16天前
|
开发工具 git
MAC如何使用Git命令行上传本地项目及理解,failed to push some refs to ‘https://gitee.com/brother-barking/spxx.git
MAC如何使用Git命令行上传本地项目及理解,failed to push some refs to ‘https://gitee.com/brother-barking/spxx.git
|
15天前
|
开发工具 git
git push xxx not found问题解决
git push xxx not found问题解决
|
1月前
|
开发工具 git
git pull之后出现REBASE(1/1)
git pull之后出现REBASE(1/1)
33 3
|
数据可视化 开发工具 Android开发
Android Git 拉取代码报错:error: cannot pull with rebase: Your index contains uncommitted changes.
造成原因:在使用Android Studio中Git的Commit Directory 将本地更改的代码保存到本地后,点击commit,发现提交不上去,发现本地有代码,这时候拉取代码,报错:cannot pull with rebase: Your index contains uncommitted changes.表示我的索引有未提交的改变