master:主分支
other:其他分支
- 首先查看分支 git branch
- 如果分支在主分支上忽略此步,如果不在切换分支 git checkout other
- 在other分支上拉取代码 git pull
- 最重要的一步,拉完代码后,在切换到master分支上(想要合并哪个分支就切换哪个分支上merge)例如 现在要把other分支 往 master分支上合并,就要切到master分支上进行merge
- 然后把other分支的代码merge到主分支 git merge other
- 最后 git push 推上去完成,就将 你自己分支的代码就合并到主分支上了。
- 同理 主分支的代码合并到自己的分支也是如此,记住步骤4就可以,先pull代码,然后就要切到自己分支上进行merge master 分支上的 git merge master
补充
拉其它分支代码 git pull orgin xxxx
拉完之后
git add .
git commit -m'xxxx'
git push
退出vim模式-----
:wq