单个文件的硬重置

随声附和 提交于 2020-08-07 21:42:55

问题:

I currently have three modified files in my working directory. 我目前在工作目录中有三个修改过的文件。 However I want one of them to be reset to the HEAD status. 但是我希望其中一个重置为HEAD状态。

In SVN I'd use svn revert <filename> (followed by svn update <filename> if needed) but in git I should use git reset --hard . 在SVN中,我使用svn revert <filename> (如果需要,然后是svn update <filename> )但是在git中我应该使用git reset --hard However this command cannot operate on a single file. 但是,此命令无法在单个文件上运行。

Is there any way in git to discard a single file changes and overwrite it with a fresh HEAD copy? 有没有办法在git中丢弃单个文件更改并用新的HEAD副本覆盖它?


解决方案:

参考一: https://stackoom.com/question/TzKY/单个文件的硬重置
参考二: https://oldbug.net/q/TzKY/Hard-reset-of-a-single-file
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!