If you want remove all local changes from your working copy, simply stash them:
(如果要从工作副本中删除所有本地更改,只需将它们存储起来:)
git stash save --keep-index
If you don't need them anymore, you now can drop that stash:
(如果您不再需要它们,现在可以删除该存储:)
git stash drop
If you want to overwrite only specific parts of your local changes, there are two possibilities:
(如果只想覆盖本地更改的特定部分,则有两种可能性:)
Commit everything you don't want to overwrite and use the method above for the rest.
(提交所有您不想覆盖的内容,其余使用上面的方法。)
Use git checkout path/to/file/to/revert
for the changes you wish to overwrite.
(使用git checkout path/to/file/to/revert
来覆盖您想要覆盖的更改。)
Make sure that file is not staged via git reset HEAD path/to/file/to/revert
. (确保未通过git reset HEAD path/to/file/to/revert
。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…