假如我们现在在dev分支上,刚开发完项目,执行了下列命令
git add . git commit -m 'jiangxu' git push -u origin jiangxu
合并主干前先切换到主干
git checkout master
如果是多人开发的话,需要把远程主干上的代码pull下来
git pull origin master
然后自己分支的代码合并到master上
git merge jiangxu
然后查看状态
git status On branch master Your branch is ahead of 'origin/master' by 12 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean
上面的意思就是你有12个commit,需要push到远程master上
执行下面命令即可
git push origin master