git 您尚未完成合并(MERGE_HEAD 存在)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11646107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
You have not concluded your merge (MERGE_HEAD exists)
提问by Ankit Suri
I made a branch called 'f' and did a checkout to master. When I tried the git pull
command I got this message:
我创建了一个名为“f”的分支,并对 master 进行了结帐。当我尝试这个git pull
命令时,我收到了这条消息:
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
When I try the git status
, it gave me the following:
当我尝试 时git status
,它给了我以下信息:
On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 13 different commit(s) each, respectively.
#
# Changes to be committed:
#
# modified: app/assets/images/backward.png
# modified: app/assets/images/forward.png
# new file: app/assets/images/index_background.jpg
# new file: app/assets/images/loading.gif
# modified: app/assets/images/pause.png
# modified: app/assets/images/play.png
# new file: app/assets/javascripts/jquery-ui-bootstrap.js
# new file: app/assets/stylesheets/jquery-ui-bootstrap.css
# modified: app/controllers/friends_controller.rb
# modified: app/controllers/plays_controller.rb
# modified: app/mailers/invite_friends_mailer.rb
# modified: app/mailers/send_plays_mailer.rb
# modified: app/mailers/shot_chart_mailer.rb
# modified: app/views/friends/show_plays.html.erb
# modified: app/views/layouts/application.html.erb
# modified: app/views/plays/_inbox_table.html.erb
# modified: app/views/plays/show.html.erb
# modified: app/views/welcome/contact_form.html.erb
# modified: app/views/welcome/index.html.erb
# modified: log/development.log
# modified: log/restclient.log
# new file: tmp/cache/assets/C1A/C00/sprockets%2Fb7901e0813446f810e560158a1a97066
# modified: tmp/cache/assets/C64/930/sprockets%2F65aa1510292214f4fd1342280d521e4c
# new file: tmp/cache/assets/C73/C40/sprockets%2F96912377b93498914dd04bc69fa98585
# new file: tmp/cache/assets/CA9/090/sprockets%2Fa71992733a432421e67e03ff1bd441d8
# new file: tmp/cache/assets/CCD/7E0/sprockets%2F47125c2ebd0e8b29b6511b7b961152a1
# modified: tmp/cache/assets/CD5/DD0/sprockets%2F59d317902de6e0f68689899259caff26
# modified: tmp/cache/assets/CE3/080/sprockets%2F5c3b516e854760f14eda2395c4ff2581
# new file: tmp/cache/assets/CED/B20/sprockets%2F423772fde44ab6f6f861639ee71444c4
# new file: tmp/cache/assets/D0C/E10/sprockets%2F8d1f4b30c6be13017565fe1b697156ce
# new file: tmp/cache/assets/D12/290/sprockets%2F93ae21f3cdd5e24444ae4651913fd875
# new file: tmp/cache/assets/D13/FC0/sprockets%2F57aad34b9d3c9e225205237dac9b1999
# new file: tmp/cache/assets/D1D/DE0/sprockets%2F5840ff4283f6545f472be8e10ce67bb8
# new file: tmp/cache/assets/D23/BD0/sprockets%2F439d5dedcc8c54560881edb9f0456819
# new file: tmp/cache/assets/D24/570/sprockets%2Fb449db428fc674796e18b7a419924afe
# new file: tmp/cache/assets/D28/480/sprockets%2F9aeec798a04544e478806ffe57e66a51
# new file: tmp/cache/assets/D3A/ED0/sprockets%2Fcd959cbf710b366c145747eb3c062bb4
# new file: tmp/cache/assets/D3C/060/sprockets%2F363ac7c9208d3bb5d7047f11c159d7ce
# new file: tmp/cache/assets/D48/D00/sprockets%2Fe23c97b8996e7b5567a3080c285aaccb
# new file: tmp/cache/assets/D6A/900/sprockets%2Fa5cece9476b21aa4d5f46911ca96c450
# new file: tmp/cache/assets/D6C/510/sprockets%2Fb086a020de3c258cb1c67dfc9c67d546
# new file: tmp/cache/assets/D70/F30/sprockets%2Facf9a6348722adf1ee7abbb695603078
# new file: tmp/cache/assets/DA3/4A0/sprockets%2F69c26d0a9ca8ce383e20897cefe05aa4
# new file: tmp/cache/assets/DA7/2F0/sprockets%2F61da396fb86c5ecd844a2d83ac759b4b
# new file: tmp/cache/assets/DB9/C80/sprockets%2F876fbfb9685b2b8ea476fa3c67ae498b
# new file: tmp/cache/assets/DBD/7A0/sprockets%2F3640ea84a1dfaf6f91a01d1d6fbe223d
# new file: tmp/cache/assets/DC1/8D0/sprockets%2Fe5ee1f1cfba2144ec00b1dcd6773e691
# new file: tmp/cache/assets/DCC/E60/sprockets%2Fd6a95f601456c93ff9a1bb70dea3dfc0
# new file: tmp/cache/assets/DF1/130/sprockets%2Fcda4825bb42c91e2d1f1ea7b2b958bda
# new file: tmp/cache/assets/E23/DE0/sprockets%2Fb1acc25c28cd1fabafbec99d169163d3
# new file: tmp/cache/assets/E23/FD0/sprockets%2Fea3dbcd1f341008ef8be67b1ccc5a9c5
# modified: tmp/cache/assets/E4E/AD0/sprockets%2Fb930f45cfe7c6a8d0efcada3013cc4bc
# new file: tmp/cache/assets/E63/7D0/sprockets%2F77de495a665c3ebcb47befecd07baae6
# modified: tmp/pids/server.pid
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# Coachbase/
# log/development.log.orig
# log/restclient.log.orig
What should I do?
我该怎么办?
回答by Karthik Bose
OK. The problem is your previous pull failed to merge automatically and went to conflict state. And the conflict wasn't resolved properly before the next pull.
好的。问题是您之前的 pull 未能自动合并并进入冲突状态。在下一次拉动之前,冲突没有得到妥善解决。
Undo the merge and pull again.
To undo a merge:
git merge --abort
[Since git version 1.7.4]git reset --merge
[prior git versions]Resolve the conflict.
Don't forget to add and commit the merge.
git pull
now should work fine.
撤消合并并再次拉动。
要撤消合并:
git merge --abort
[自 git 1.7.4 版起]git reset --merge
[以前的 git 版本]解决冲突。
不要忘记添加并提交合并。
git pull
现在应该可以正常工作。
回答by knagode
If you are sure that you already resolved all merge conflicts:
如果您确定已经解决了所有合并冲突:
rm -rf .git/MERGE*
And the error will disappear.
错误将消失。
回答by fantabolous
I think it's worth mentioning that there are numerous scenarios in which the message You have not concluded your merge (MERGE_HEAD exists)
could occur, because many people have probably arrived at this page after searching for said message. The resolution will depend on how you got there.
我认为值得一提的是,该消息You have not concluded your merge (MERGE_HEAD exists)
可能出现的场景有很多,因为很多人可能是在搜索该消息后才到达此页面的。分辨率将取决于您如何到达那里。
git status
is always a useful starting point.
git status
始终是一个有用的起点。
If you've already merged the contents to your satisfaction and are still getting this message, it could be as simple as doing
如果您已经将内容合并到您满意的程度并且仍然收到此消息,则操作可能很简单
git add file
git commit
But again, it really depends on the situation. It's a good idea to understand the basics before attempting anything (same link Terence posted): Git - Basic Merge Conflicts
但同样,这真的取决于情况。在尝试任何事情之前了解基础知识是个好主意(Terence 发布的相同链接): Git - Basic Merge Conflicts
回答by Badr Bellaj
I think this is the right way :
我认为这是正确的方法:
git merge --abort
git fetch --all
Then, you have two options:
然后,您有两个选择:
git reset --hard origin/master
OR If you are on some other branch:
或者如果您在其他分支机构:
git reset --hard origin/<branch_name>
回答by Taimoor Changaiz
I resolved conflicts and also committed but still getting this error message on git push
我解决了冲突并提交了但仍然收到此错误消息 git push
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
所有冲突都已解决,但您仍在合并。
(使用“git commit”结束合并)
I did these steps to resolve error:
我做了以下步骤来解决错误:
rm -rf .git/MERGE*
git pull origin branch_name
git push origin branch_name
回答by Franklin
Try
尝试
git reset --hard origin/trunk
'trunk' is the branch that I am trying to get to.
'trunk' 是我想要到达的分支。
I don't know how or why this works. It had something to do with some commit I made which was forcing my pull requests to do a merge.
我不知道这如何或为什么起作用。它与我所做的一些提交有关,这迫使我的拉取请求进行合并。
回答by Kazim Noorani
Try changing any temporary file. Like just remove any space or add space and then commit and push that file.
尝试更改任何临时文件。就像删除任何空间或添加空间,然后提交并推送该文件。
git add 'temporary_change_file'
git commit -m "git issue resolving"
git push origin develop
git add 'temporary_change_file'
git commit -m "git 问题解决"
git push origin 开发
And then try git pull,
然后尝试 git pull,
git pull origin develop
git pull origin 开发
Hope this might help you.
希望这可以帮助你。
回答by Rohith
Blockquote
块引用
If you're trying to pull from another branch into your branch. If you're seeing this error.
如果您试图从另一个分支拉入您的分支。如果您看到此错误。
First, you should try doing git commit and then pull another branch into yours.
首先,您应该尝试执行 git commit,然后将另一个分支拉入您的分支。
- "git add . "
- git commit
- Then do git pull from the required branch.
- “git 添加。”
- 提交
- 然后从所需的分支执行 git pull 。
回答by Cosmo Scrivanich
In my case I had a cherry pick that produce a number of Merge Conflicts, so I decide to not complete the cherry pick. I discarded all my changes. Doing so put me into a state where I received the following error:
就我而言,我有一个会产生许多合并冲突的樱桃选择,所以我决定不完成樱桃选择。我放弃了所有更改。这样做使我进入收到以下错误的状态:
You have not concluded your merge (MERGE_HEAD exists
您尚未完成合并(MERGE_HEAD 存在
To fix the issue I performed the following git command which fixed the problem.
为了解决这个问题,我执行了以下解决问题的 git 命令。
git cherry-pick --abort
回答by Terence
Best approach is to undo the merge and perform the merge again. Often you get the order of things messed up. Try and fix the conflicts and get yourself into a mess.
最好的方法是撤消合并并再次执行合并。通常你会把事情的顺序搞砸。尝试解决冲突,让自己陷入一团糟。
So undo do it and merge again.
所以撤消它并再次合并。
Make sure that you have the appropriate diff tools setup for your environment. I am on a mac and use DIFFMERGE. I think DIFFMERGE is available for all environments. Instructions are here: Install DIFF Merge on a MAC
确保为您的环境设置了适当的差异工具。我在 Mac 上使用 DIFFMERGE。我认为 DIFFMERGE 适用于所有环境。说明在这里:在 MAC 上安装 DIFF Merge
I have this helpful resolving my conflicts: Git Basic-Merge-Conflicts
我有这个帮助解决我的冲突:Git Basic-Merge-Conflicts