Batch remove from Mercurial repo

If you did something wrong and created a lot of files in a mercurial repo, you can delete all very quickly with this
hg st | grep ‘^?’ | cut -d ‘ ‘ -f 2 | xargs rm
Be carefully to execute “hg add” for files you intend to keep otherwise you will lose those files forever.

Leave a comment

Your email address will not be published. Required fields are marked *