Auto Merge Failed 解决方案
来源:互联网 发布:降低音量软件 编辑:程序博客网 时间:2024/05/22 00:42
1.出错场景:
协同开发时,我们从远程服务器上pull下代码的时候,出现以下提示信息:
Auto Merge Failed; Fix Conflicts and Then Commit the Result.
2.原因分析:
利用git status,输出如下:
root@hyk-virt:/etc# git status
# On branch master
# Your branch and ‘origin/master’ have diverged,
# and have 2 and 2 different commits each, respectively.
#
# Unmerged paths:
# (use “git add/rm …” as appropriate to mark resolution)
#
# both modified: apt/sources.list
#
# Changes not staged for commit:
# (use “git add …” to update what will be committed)
# (use “git checkout – …” to discard changes in working directory)
#
# modified: cups/subscriptions.conf
# modified: cups/subscriptions.conf.O
# modified: mtab
# modified: update-manager/release-upgrades
#
no changes added to commit (use “git add” and/or “git commit -a”)
从git status的结果可以发现:其中sources.list这个文件存在合并冲突
而进一步分析git pull的原理,实际上git pull是分了两步走的,(1)从远程pull下origin/master分支(2)将远程的origin/master分支与本地master分支进行合并
以上的错误,是出在了第二步骤
3.解决方法
方法一:如果我们确定远程的分支正好是我们需要的,而本地的分支上的修改比较陈旧或者不正确,那么可以直接丢弃本地分支内容,运行如下命令(看需要决定是否需要运行git fetch取得远程分支):
解释:
git-reset - Reset current HEAD to the specified state
–hard
Resets the index and working tree. Any changes to tracked files
in the working tree since are discarded.
方法二:我们不能丢弃本地修改,因为其中的某些内容的确是我们需要的,此时需要对unmerged的文件进行手动修改,删掉其中冲突的部分,然后运行如下命令
方法三:如果我们觉得合并以后的文件内容比价混乱,想要废弃这次合并,回到合并之前的状态,那么可以运行如下命令:
$:git reset –hard HEAD
声明:该文章系网友上传分享,此内容仅代表网友个人经验或观点,不代表本网站立场和观点;若未进行原创声明,则表明该文章系转载自互联网;若该文章内容涉嫌侵权,请及时向上学吧网站投诉>>
- Auto Merge Failed 解决方案
- git pull报错:Auto Merge Failed; Fix Conflicts and Then Commit the Result.
- git pull报错:Auto Merge Failed; Fix Conflicts and Then Commit the Result.
- git pull报错:Auto Merge Failed; Fix Conflicts and Then Commit the Result
- git: Auto Merge Failed; Fix Conflicts and Then Commit the Result.
- git pull报错:Auto Merge Failed; Fix Conflicts and Then Commit the Result.
- git 使用场景一,pull报错:Auto Merge Failed; Fix Conflicts and Then Commit the Result.
- rpmdb open failed解决方案
- parseSdkContent failed 解决方案
- parsesdkcontent failed解决方案
- socket bind failed解决方案
- SMTP connect() failed 解决方案
- 最新AUTO病毒变种分析和解决方案
- Auto值的CSS3 Transition解决方案
- IE9 BUG overflow :auto 底部空白解决方案
- Failed to read auto-increment value from storage engine
- Xamarin.Android Binding - When auto-generated class failed
- IBDesignable Errors Failed to update auto layout status:……
- SQL Prompt5 破解版下载+使用说明
- 基于Tomcat7、Java、WebSocket的服务器推送聊天室
- 9 个让 JavaScript 调试更简单的 Console 命令
- C/C++中的有符号和无符号的位运算问题
- IOS,SWIFT开发细节杂烩
- Auto Merge Failed 解决方案
- sitecore 16/8/11
- Android 屏蔽/禁止ListView,GridView的滑动/滚动功能
- 《Motion Design for iOS》(四十)
- Dialog、Toast、Snackbar的区别和使用
- 实时错误‘-2147217873(80040e2f)’
- GitHub Ant-Design/ant-init 使用示例
- Toggle Buttons
- Thrift入门