Avoid orphaned .orig files after resolving conflicts from a Git merge Avoid orphaned .orig files after resolving conflicts from a Git merge git git

Avoid orphaned .orig files after resolving conflicts from a Git merge


It's the git mergetool that produces these files, you can disable them with this command:

git config --global mergetool.keepBackup false

See the git-config manpage:

http://man.he.net/man1/git-config


Quite likely those files are created by KDiff3 tool you probably using for merging files. The easiest way to solve the problem is where it was originated:

  1. open KDiff3,
  2. go to Settings / Configure KDiff3 / Directory,
  3. un-tick checkbox "Backup files (.orig)"


I think this should work:

git status -su | grep -e"\.orig$" | cut -f2 -d" " | xargs rm

See https://stackoverflow.com/a/10744524/670915 for details