如何重置所有已删除的文件

问题描述:

我有一个包含许多文件更改和许多已删除文件的工作文件夹。
我想将所有删除的文件重置为当前的HEAD,并保留任何
修改文件。我怎样才能做到这一点?

I have a working folder with many file changes and many deleted files. I want to reset all the deleted files to the current HEAD, and leave any modified files alone. How can I do this?

下面的脚本虽然不是纯粹的git解决方案, / strong>。

The following script might do the job though it is not a pure git solution.

 git status -s | awk '{if($1=="D") { print $2 }}' | xargs git checkout --