可能是重复的问题:
如何从git工作副本中删除未跟踪的文件?
是否有可能告诉git删除未跟踪的文件?主要是类似于重置的东西吗?
示例:
git checkout -- index.php <-- revert my file
git checkout -- master <-- this would revert the entire repo back to the last commit on master, removing (deleting) any and all untracked files as well as reverting committed ones.
我知道在shell上做这件事是很琐碎的。但是我想知道是否可以在Git中完成?
git checkout -- master
不会检出分支master
,而是会检出当前提交(HEAD
)中名为master
的文件。 - knittl