Git merge合并分支的总结
创建分支并合并到主分支
- 创建分支
git checkout -b mybranch
git push origin mybranch
git add .
git commit -m "info..."
git pull
git push
说明:
若pull
报错 vim .git/config
复制拷贝分支信息
- 把我的
mybranch
分支合并到主分支explorer
上
git checkout explorer
git merge mybranch
git status
git push
git mrege
后,status
提示有冲突的解决
- 手动修改文件解决冲突,然后再次提交
git add .
git commit -m "info"
git pull
git push
遇到的问题
git pull
后又提示冲突,并不能push
,然后解决再add
陷入死循环,甚至不能重置项目,只能删项目文件夹,重新clone
自行找到的土办法
- 在第一次
git mrege
出现冲突并手工修改完后,按一下步骤借助stash
处理,其实最开始我stash
是为了保存住代码,歪打正着
- 在第一次
git add .
git stash
git pull
git stash apply stash@{0}
git commit -m "update"
git pull
git push
说明:
这样git log
中就像是把之前在子分支上的所有提交归纳为一次普通提交,不会有mrege
的提示,以前在我的子分支上的commit信息也没了,如各位看官有什么科学的办法,劳请告知
- 上一篇: XAMPP安装memcache扩展的总结
- 下一篇: utf8转unicode的总结