I want to unstage all file deletes. Is there an easy way?
I want to apply this to the file pattern of all deletes.
The output of git status --porcelain
is a great way to build one-liners and scripts for tasks like this:
git status --porcelain | awk '$1 == "D" {print $2}' | xargs git reset HEAD
In case your path-/filenames returned from git status
contain
space
characters, the call to awk
can be modified to include the
entire (quoted) path/filename including spaces:
git status --porcelain|awk '$1 == "D" {print substr($0, index($0,$2))}'|xargs git reset HEAD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With