If you see the help for hg rm --help : hg remove [OPTION]... FILE... Schedule the indicated files for removal from the current branch. This command schedules the files to be removed at the next commit.
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.
btw. find
utility has an action -delete
so you can type only:
find <path-to-files> -name '*.orig' -delete
If you just want to delete the .orig files, and you happen to be on a Windows computer, the following seems to work well:
D:\workspace>hg purge -I **/*.orig --all
This will delete all untracked files that end in .orig, but won't delete other untracked files, as the other answers would.
You can test this before running it by putting the --print
flag in as well.
The following will remove .orig files in your entire working copy hierarchy and also works for paths containing spaces:
find . -name *.orig | while read -d $'\n' file; do rm -v "$file"; done;
I use an alias in my .bash_profile:
alias clearorig='echo "Removing .orig files..."; find . -name *.orig | \
while read -d $'\''\n'\'' file; do rm -v "$file"; done;'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With