How do you disable mercurial from leaving .orig files after a merge?

Update:

According to the Mercurial config documentation the defaults section is deprecated. The Mercurial wiki is also particularly critical of their use. The recommended replacement is to create a command alias (while not shadowing built in commands) that provides the functionality you are looking for. Here's what I've switched to in my config.

[alias]
undo = revert --no-backup

Original:

I stumbled across this while experiencing the exact same problem. I had been just dealing with it and deleting the .orig files, since I never seem to need them. The best recommendation I've found was on StackOverflow and suggests using the defaults section of your hgrc file. To address this specifically, add the following section:

[defaults]
revert = --no-backup

Here's where I read about this.


Personally I will add *.orig files to the hg ignore list, and from time to time do a

rm **/*.orig

Alternatively you can use Hg Purge extension


The following seems to be enough to convince hg not to write these files:

# ~/.hgrc
[ui]
origbackuppath = /tmp/hg-trash