Skip to main content

Command Palette

Search for a command to run...

Reverting all deletes in Git, leaving file modifications in place

Updated
1 min read

I asked how to do this on StackOverflow, and the answer is:

git diff --diff-filter=D --name-only | xargs git checkout

You need the "xargs": just piping the output of "diff" to "checkout" doesn't work.

More from this blog

Roderick's Debug Diary

58 posts

https://mastodon.social/@rvkennedy

Reverting all deletes in Git, leaving file modifications in place