git合并分支
方法一:使用git merge合并
// 将分支合并到主支上
# 1. 切换的分支上
git checkout <分支名称>
# 2. 在分支上提交新修改的 例:
git add README.MD
git commit -m "增加系统维护模块"
git push origin <分支名称>
# 3. 切换到主支上
git checkout <主支名称>
# 4. 合并分支
git merge <主支名称>
# 5. push 提交
git push origin <主支名称>
如果在进行第4部的时候出现 (master|MERGING) 冲突错误,
先查看冲突信息,解决冲突。
git status //查看冲突
再回退版本信息
git reset --hard head //回退版本信息
方法二:先pull在push
1.先git pull拉取要合并的分钟
git pull origin <分支名称>
# 例:拉取dev分组
git pull origin dev
2.如有冲突,就解决冲突
3.提交当前分支
# 提交git
git add .
git commit -m "合并分组"
git push origin <当前分支名称>
# 例:提交当前master分支
git add .
git commit -m "合并分组"
git push origin master