Avoid orphaned .orig files after resolving conflicts from a Git merge
After I perform a Git merge and resolve the conflicts, there are leftover .orig versions of the conflicting files. How can I automatically delete those after the conflict is successfully resolved?
- Prevent merge at git pull
- Get parents of a merge commit in git
- Why is git merging when I do a pull?
- How does git handle commits in a merge?
- git rebase -i, and clean commits
- What is the git command to diff against a remote which has not been merged yet?
5 Solutions collect form web for “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:
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
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:
- open KDiff3,
- go to Settings / Configure KDiff3 / Directory,
- un-tick checkbox “Backup files (.orig)“
Git doesn’t create *.orig files. It only marks the sections in the conflicting file with
<<<< ... ==== ... >>>>.
Which tool are you using? You’ll have to disable it there.
But tools like WinMerge indeed create these files, but they automatically process and remove them when you mark the file as resolved within the editor.
Even I was geting the same error, when I copy + paste the command from a word document. But I tried removing the
-- before the switch
global and re-type it manually on the command prompt. It WORKED!
May be it was due to some mis-interpretation of the Charectes in the MS_Wrod and the Command Prompt.