无法拉取,因为您有未合并的文件,git stash 不起作用。不想承诺
我只想拉。我有一些更改需要忽略,我的 Gemfile 和 Gemlock 文件,我很乐意覆盖它们并拉取。我尝试隐藏我的更改,但这对我来说没有成功。我该怎么办?
git pull
M Gemfile
U Gemfile.lock
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
~/projects/sms/apps2/apps2_admin(apps2)$ git stash save "saved"
Gemfile.lock: needs merge
Gemfile.lock: needs merge
Gemfile.lock: unmerged (4ea16799dba7bfe1db28adecf36dee1af5195c1a)
Gemfile.lock: unmerged (e77439c9f86d1d0eda7ae0787e3e158f90959e68)
Gemfile.lock: unmerged (d690d3860db1aa8e46c1bb2f4de3e52a297b5c26)
fatal: git-write-tree: error building trees
Cannot save the current index state
~/projects/sms/apps2/apps2_admin(apps2)$ git pull
M Gemfile
U Gemfile.lock
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. What do I do?
git pull
M Gemfile
U Gemfile.lock
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
~/projects/sms/apps2/apps2_admin(apps2)$ git stash save "saved"
Gemfile.lock: needs merge
Gemfile.lock: needs merge
Gemfile.lock: unmerged (4ea16799dba7bfe1db28adecf36dee1af5195c1a)
Gemfile.lock: unmerged (e77439c9f86d1d0eda7ae0787e3e158f90959e68)
Gemfile.lock: unmerged (d690d3860db1aa8e46c1bb2f4de3e52a297b5c26)
fatal: git-write-tree: error building trees
Cannot save the current index state
~/projects/sms/apps2/apps2_admin(apps2)$ git pull
M Gemfile
U Gemfile.lock
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
说明:
请参阅 http://git-scm.com/docs 上的文档。
Explanation:
See documentation at http://git-scm.com/docs.
您可以使用 git checkout来签出文件的提交版本(从而放弃您的更改),或使用 git reset --hard HEAD 来丢弃任何内容所有文件的未提交更改。
You can use
git checkout <file>
to check out the committed version of the file (thus discarding your changes), orgit reset --hard HEAD
to throw away any uncommitted changes for all files.我已经尝试过这两种方法,但仍然因冲突而失败。在我忍无可忍的时候,我在另一个位置克隆了 master,将所有内容复制到另一个分支中并提交。这让我可以继续。
“-X 他们的”选项应该为我做到这一点,但它没有。
I've tried both these and still get failure due to conflicts. At the end of my patience, I cloned master in another location, copied everything into the other branch and committed it. which let me continue.
The "-X theirs" option should have done this for me, but it did not.
我遇到了同样的错误,我用以下方法解决了它: git merge -s recursive -X theirs origin/master
I've had the same error and I solve it with:
git merge -s recursive -X theirs origin/master