Search code examples
git

How do I reset all deleted files


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?


Solution

  • 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 --