[英]Using git desktop I committed my changes and pressed sync. There were merge errors and my local files got changed a lot. How to undo changes?
当我不应该同步并更改许多本地文件时,我不小心进行了同步,如何撤消此同步?
The following answer assumes that a) you committed all your valuable work already, and b) you don't want anything which came in from the recent merge ("sync"), from the remote branch. 以下答案假定a)您已经完成了所有有价值的工作,b)您不希望从远程分支的最近合并(“ sync”)中得到任何东西。 Assuming both of these are true, you can just do a hard reset to the current HEAD of your branch:
假设这两个都是正确的,则只需将硬重置为分支的当前HEAD:
git reset --hard HEAD
In case you ever end up in a similar situation where you don't want to nuke your entire working directory (and maybe stage as well, if you've staged anything), you can use the following command to checkout an individual file from the HEAD: 如果你曾经结束了在类似的情况下,你不想要核弹攻击你的整个工作目录(也许阶段为好,如果你上演的任何东西),你可以使用下面的命令来签从一个单独的文件头:
git checkout -- path/to/some/file.ext
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.