Git Cherry-pick Deleted Files

At some point I had foolishly added node_modules directory and needed to remove those files from the repo.

This was a matter of:

Add node_modules/ to top level repository directory .gitignore and then ran

git rm -r --cached ../example.com/web/app/themes/custom-theme/node_modules

Then I had a couple of other branches I wanted to add only that change to so:

git cherry-pick 1f8b8bd1a62e08

There was a merge conflict of all of the “deleted by them” and “deleted by us”.

Found a couple of Stack Overflow posts with recommendations on how to resolve:

git status | sed -n 's/deleted by us://p' | xargs git rm
git diff --name-only --diff-filter=U | xargs git rm