git merge笔记
Posted 大墨垂杨
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了git merge笔记相关的知识,希望对你有一定的参考价值。
==从分支dev合并到master==
git checkout dev
git pull
git checkout master
git merge dev
git push -u origin master
==从master合并到分支dev==
git checkout master
git pull
git checkout dev
git merge master
git push -u origin dev
==遇到的问题==
2021/5/14
执行git merge时报错
CONFLICT (modify/delete): rexel-core/src/test/java/com/rexel/test/CodeCounter.java deleted in HEAD and modified in master. Version master of rexel-core/src/test/java/com/rexel/test/Cod eCounter.java left in tree. CONFLICT (modify/delete): rexel-core/src/main/resources/mybatis/business/WaterElectricCostMapper.xml deleted in HEAD and modified in master. Version master of rexel-core/src/main/resou rces/mybatis/business/WaterElectricCostMapper.xml left in tree.
如果代码冲突的时候,需要强制使某一方生效,可以在下面的页面执行。
通过git status查看merge结果,可以看到有文件冲突。我的分支上把没有用的东西删除掉了,与master冲突。
解决办法
git add .
git commit -m \'解决冲突\'
git pull origin master
git merge master
以上是关于git merge笔记的主要内容,如果未能解决你的问题,请参考以下文章
git:Git fetch和git pull的区别, 解决Git报错:error: You have not concluded your merge (MERGE_HEAD exists).(代码片
Git 回滚Merge的代码(commit is a merge but no -m option was given.)