有没有一条Git命令可以撤消工作树和索引中的所有未提交更改,并删除新创建的文件和文件夹?
如果您只想在当前工作目录中恢复更改,请使用
git checkout -- .
在此之前,您可以列出将被还原的文件,而不实际采取任何操作,只是为了检查会发生什么,使用:
git checkout --
你可以运行下列两个命令:
# Revert changes to modified files. git reset --hard # Remove all untracked files and directories. # '-f' is force, '-d' is remove directories. git clean -fd
用户名或电子邮箱地址
密码