如何从命令行进行 git-revert?
当我通过 TortoiseGit 执行 git revert 时,我得到这个可爱的窗口:
但是,当我想做与命令行相同,文档 管理让我完全困惑。如何恢复所有本地未提交的更改?
When I do git revert via TortoiseGit, I get this lovely window :
However, when I want to do the same from the command line, the documentation manages to completely confuse me. How do I revert all local uncomitted changes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要放弃所有本地更改,请不要使用恢复。 revert 用于恢复提交。相反,请执行以下操作:
当然,如果您像我一样,输入该命令 7 微秒后,您会记住一些您希望没有删除的内容,因此您可能更喜欢使用:
它会丢弃工作目录中的更改,但使它们可检索。
To discard all local changes, you do not use revert. revert is for reverting commits. Instead, do:
Of course, if you are like me, 7 microseconds after you enter that command you will remember something that you wish you hadn't just deleted, so you might instead prefer to use:
which discards the changes from the working directory, but makes them retrievable.
假设您尚未承诺,您还可以:
Assuming you haven't committed yet, you can also:
像我这样的 Git 新手应该知道
工作目录' != pwd
。它更确切地说是指整棵树。
所以我很感谢 Williams 建议使用:
可以通过以下方式撤消:
Git newbies like me should be aware that
working directory' != pwd
.It rather means the whole tree.
So I'm thankful for Williams recommendation to use:
which can be undone via the following: