gitcherry-pick 说存在本地更改,但 gitstatus 没有说什么

发布于 2024-10-04 07:00:37 字数 379 浏览 1 评论 0原文

$ git cherry-pick 5de83068
error: Your local changes to the following files would be overwritten by merge:
        Components/ApplicationEnums/Application.cs
Please, commit your changes or stash them before you can merge.
Aborting

$ git status
# On branch master
nothing to commit (working directory clean)

更新 抱歉,我切换到另一个分支,然后再次切换回来,无法再重现这个:(

$ git cherry-pick 5de83068
error: Your local changes to the following files would be overwritten by merge:
        Components/ApplicationEnums/Application.cs
Please, commit your changes or stash them before you can merge.
Aborting

$ git status
# On branch master
nothing to commit (working directory clean)

UPDATE Sorry, I switched to another branch, and switched back again, and can't reproduce this anymore :(

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(6

腻橙味 2024-10-11 07:00:37

我有这个问题。
错误是 - 错误:您的本地更改将被cherry-pick覆盖。
提示:提交您的更改或隐藏它们以继续。
致命:樱桃挑选失败

对我来说,原因是我在暂存区域中有一个我不想提交的文件。我将该文件从暂存区域移出,并尝试再次进行挑选,结果成功了。

I had this issue.
Error was - error: Your local changes would be overwritten by cherry-pick.
hint: Commit your changes or stash them to proceed.
fatal: cherry-pick failed

The reason for me was I had a file in staging area that I don't wants to commit. I moved that file from staging area and tried to chery-pick again and that was a success.

寄人书 2024-10-11 07:00:37

我不太确定问题是什么,但您可以使用以下语句重置工作副本:

git reset --hard origin/master

I'm not quite sure whats the problem but you can reset your working copy with the follwing statement:

git reset --hard origin/master
樱娆 2024-10-11 07:00:37

精选的补丁与应用更改的接缝处没有对齐。执行 --no-commit 看看会发生什么。

The patch from the cherry-pick does not align in terms of the seams of where the changes would be applied. Do a --no-commit to see what happens.

西瑶 2024-10-11 07:00:37

就我而言,我在运行时收到错误

git cherry-pick -x <commit1> <commit2> <commit3>

运行樱桃选择独立工作:

echo <commit1> <commit2> <commit3> | xargs -n 1 git cherry-pick -x 

In my case, I got the error while running

git cherry-pick -x <commit1> <commit2> <commit3>

Running the cherry-picks independently works:

echo <commit1> <commit2> <commit3> | xargs -n 1 git cherry-pick -x 
单身情人 2024-10-11 07:00:37

我在虚拟机上使用 git 时遇到了这个问题,其中工作副本是 VMware 共享文件夹。我真的不知道解决方案是什么。就我而言,我能够让 git 通过 git stash 移走它认为存在的更改(经检查似乎完全是空的);更改被移走后,我可以在现在干净的工作副本之上进行挑选。 (在此之后,我刚刚删除了隐藏的内容。)

I've had this problem when using git on a virtual machine, where the working copy was a VMware shared folder. I don't really know what the solution is. In my case I was able to get git to move away the changes it thought existed via git stash (upon inspection appeared to be completely empty); after the changes had been moved away I could cherry-pick on top of the now clean working copy. (After this, I just deleted the stash.)

情话墙 2024-10-11 07:00:37

我是通过谷歌搜索这个奇怪的消息来到这里的,我想表达我的两分钱。

对于有价值的事情,我的场景如下:

  • 真实代码驻留在虚拟机中
  • Mac OS 通过 samba 网络共享连接到它
  • Visual Studio Code 在我的 Mac 上运行
  • git 在 VS Code 中运行

我确实经历了 OP 编写的内容和 < strong>我通过...除了等待什么也没做!:)

也许存在缓存或网络问题,谁知道呢。

I came here from googling about that weird message and I'd like to put my two cents.

For what is worth, my scenario is as following:

  • real code resides in a Virtual Machine
  • Mac OS connects to it via samba network sharing
  • Visual Studio Code is running on my Mac
  • git is running from within VS Code

I did experienced what OP wrote and I resolved by doing... nothing but wait! :)

Maybe there was a cache or a network problem, who knows.

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