Last Updated: February 25, 2016
·
1.932K
· mchail

Remove merge artifacts in a git repository

Everyone does it at least once...you perform a git merge, hit some conflicts, and are left with .orig files. Here's a one-liner you can run from the root of your repo to delete those (and tell you which ones were deleted).

find . | grep -P 'orig$' ; find . | grep -P 'orig$' | xargs rm

I put this in my ~/.aliases file as rmorig.

alias rmorig="find . | grep -P 'orig$' ; find . | grep -P 'orig$' | xargs rm"

1 Response
Add your response

Could be simplified to:

find . -name \*.orig -exec rm {} \;

or in zsh:

rm */.orig

over 1 year ago ·