git合并分支代码的方法

1.先提交本地代码,防止被拉取其他分支的代码污染(self为自己的分支 other为想要拉取的分支)

git add .
git commit -m '备注信息'
git push origin self

2.然后git切换到你所要拉取的分支other  拉取该分支代码

git checkout other  
git pull origin other  

3.切回自己的分支

git checkout self
git merge other  

4.合并后代码提交到本地分支

git add .
git commit -m '备注信息'
git push origin self

 

posted @ 2019-11-13 16:18  夏目友人喵  阅读(1227)  评论(0编辑  收藏  举报