If you want to revert changes made to your working copy, do this:
(如果要还原对工作副本所做的更改,请执行以下操作:)
git checkout .
If you want to revert changes made to the index (ie, that you have added), do this.
(如果要还原对索引所做的更改(即已添加的更改),请执行此操作。)
Warning this will reset all of your unpushed commits to master! (警告这会重置你掌握的所有未提交的提交!)
: (:)
git reset
If you want to revert a change that you have committed, do this:
(如果要还原已提交的更改,请执行以下操作:)
git revert <commit 1> <commit 2>
If you want to remove untracked files (eg, new files, generated files):
(如果要删除未跟踪的文件(例如,新文件,生成的文件):)
git clean -f
Or untracked directories (eg, new or automatically generated directories):
(或未跟踪的目录(例如,新的或自动生成的目录):)
git clean -fd
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…