Git rm all that says "deleted by us" during a merge

Viewed 469

During a merge, sometimes there are within unmerged paths, there will be multiple files which says "deleted by us". If I want to keep them deleted, each one needs git rm applied.

How do I do that with one command instead of using git rm on each file?

2 Answers

I couldn't get j4nw's answer to work for me (using git bash in windows), so here's how I modified it for my purposes using SED: I specifically wanted to isolate the "deleted by user" lines designed by DU in the git status --porcelain output.

    git status --porcelain | sed -n -e '/^DU <dev_directory>/p' | sed 's/DU <dev_directory>/./' | xargs git rm

<dev_directory> is the root folder that all of my offending files were in. For example, here's one of the lines output from git status --porcelain:

    DU dev/src/A/filename
Related