git cherry-pick 表示存在本地更改,但 git status 什么也没说
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4264104/
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
git cherry-pick says local changes exist, but git status says nothing
提问by Benjol
$ 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)
UPDATESorry, I switched to another branch, and switched back again, and can't reproduce this anymore :(
更新抱歉,我切换到另一个分支,然后又切换回来,并且无法再重现这个:(
回答by scheffield
I'm not quite sure whats the problem but you can reset your working copy with the follwing statement:
我不太确定是什么问题,但您可以使用以下语句重置您的工作副本:
git reset --hard origin/master
回答by Nimmi Mathew
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 failedThe 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.
我有这个问题。 错误是 - 错误:您的本地更改将被cherry-pick 覆盖。提示:提交您的更改或隐藏它们以继续。致命:cherry-pick failed对我来说的原因是我在暂存区有一个我不想提交的文件。我将该文件从暂存区移出并尝试再次挑选,这是成功的。
回答by Adam Dymitruk
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.
樱桃挑选的补丁在应用更改的接缝方面不一致。做一个 --no-commit 看看会发生什么。
回答by mjs
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.)
我在虚拟机上使用 git 时遇到了这个问题,其中工作副本是 VMware 共享文件夹。我真的不知道解决方案是什么。就我而言,我能够让 git 移走它认为存在的更改git stash
(经检查似乎完全为空);在更改被移走后,我可以在现在干净的工作副本之上进行挑选。(在此之后,我刚刚删除了藏匿处。)