Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 897
Eugene Avatar asked Oct 10 '11 10:10

Eugene


People also ask

How do I fix a merge conflict with deleted files?

Select Stage Changed Files To Commit (Ctrl-I) from Commit menu. Enter a commit comment like "deleted conflicting file" Commit (ctrl-enter) Now if you restart the merge it will (hopefully) work.

What are .orig files?

An ORIG file is a file that may have been created by various programs. It stores a backup copy of a file, which has been renamed with the . orig extension so that the user knows it is the original. ORIG files are most often created manually by a user rather than by a program.

What happens when a merge conflict occurs in Git?

A merge conflict is an event that occurs when Git is unable to automatically resolve differences in code between two commits. When all the changes in the code occur on different lines or in different files, Git will successfully merge commits without your help.


2 Answers

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

like image 125
Simon Stender Boisen Avatar answered Sep 25 '22 02:09

Simon Stender Boisen


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)"
like image 32
VeganHunter Avatar answered Sep 27 '22 02:09

VeganHunter