Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

dvcs - How to automatically remove all .orig files in Mercurial working tree?

During merges mercurial leaves .orig file for any unresolved file. But after manually resolving problems and marking a file correct it does not delete the .orig file. Can it be automatically removed by some command?

I work on a Mac so I can use something like:

find . -iname '*.orig' -exec rm '{}' ';'

and alias it or something, but I'd rather use something like hg cleanup...

UPDATE:

Since some time now, Purge extension is bundled with Mercurial and solves this problem nicely.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Personally, I use

$ rm **/*.orig

if I get tired of the .orig files. This works in Zsh and in Bash 4 after you run shopt -s globstar.

But if you use another shell or want a built-in solution, then maybe you'll like the purge extension (link updated 2016-08-25). That lets you remove all untracked files with

$ hg purge

You can remove all untracked and ignored files with

$ hg purge --all

An advantage of using hg purge is that this will also cleanup directories that become empty after removing the files. The rm command line will just leave the empty directories behind.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...