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
原文地址:https://www.cnblogs.com/lxl0419/p/11850522.html