无法拉取,因为您有未合并的文件,git stash 不起作用。不想承诺

发布于 2024-12-13 23:17:19 字数 1003 浏览 0 评论 0原文

我只想拉。我有一些更改需要忽略,我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

生死何惧 2024-12-20 23:17:19
git fetch origin
git reset --hard origin/master
git pull

说明:

  • Fetch 将从另一个存储库下载所有内容,在本例中是标记为“origin”的存储库。
  • 重置将放弃更改并恢复到存储库“origin”中提到的分支“master”。
  • Pull 只会从远程存储库获取所有内容并进行集成。

请参阅 http://git-scm.com/docs 上的文档。

git fetch origin
git reset --hard origin/master
git pull

Explanation:

  • Fetch will download everything from another repository, in this case, the one marked as "origin".
  • Reset will discard changes and revert to the mentioned branch, "master" in repository "origin".
  • Pull will just get everything from a remote repository and integrate.

See documentation at http://git-scm.com/docs.

最舍不得你 2024-12-20 23:17:19

您可以使用 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), or git reset --hard HEAD to throw away any uncommitted changes for all files.

九命猫 2024-12-20 23:17:19

我已经尝试过这两种方法,但仍然因冲突而失败。在我忍无可忍的时候,我在另一个位置克隆了 master,将所有内容复制到另一个分支中并提交。这让我可以继续。
“-X 他们的”选项应该为我做到这一点,但它没有。

git merge -s recursive -X 他们的主人

错误:“合并”不可能
因为你有未合并的文件。提示:将它们修复在工作树中,
提示:然后使用 'git add/rm ' 作为提示:适合标记
决议并做出承诺,
提示:或使用“git commit -a”。致命的:
由于未解决的冲突而退出。

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 master

error: 'merge' is not possible
because you have unmerged files. hint: Fix them up in the work tree,
hint: and then use 'git add/rm ' as hint: appropriate to mark
resolution and make a commit,
hint: or use 'git commit -a'. fatal:
Exiting because of an unresolved conflict.

九公里浅绿 2024-12-20 23:17:19

我遇到了同样的错误,我用以下方法解决了它: 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文