git 两个repository间进行Merge时,按照如下手顺, 假设 A.git :merge 源repository B.git :merge 目的repository 要merge的分支是master
1,git clone B.git git clone http://xxx.xx.xxx.xx/gitlab/B.git 2,设定upstream,upstream 为merge源的repository(A.git) git remote add upstream http://xxx.xx.xxx.xx/gitlab/A.git 3,取得merge先得最新状态 git pull 4,取得merge元得最新状态 git fetch upstream 5,把A的master分支merge到B的master分支上(通常情况下不会直接merge master的) git merge --no-ff --no-commit upstream/master 6,通过git status确认状态 git status 7,如果出现confict,手动解决confict 8 git add 添加文件 git add . 9 git commit -m "[modify] merge xxxx“ 10 git push -u origin master