Skip to content

Instantly share code, notes, and snippets.

@breyten
Last active February 22, 2019 11:17
Show Gist options
  • Save breyten/5143040 to your computer and use it in GitHub Desktop.
Save breyten/5143040 to your computer and use it in GitHub Desktop.
Automatically close inactive mercurial branches (use with care!)
for i in `hg branches |grep -v 'default' |grep -v 'production' |grep inactive |awk '{print $1}'`; do hg update $i && hg commit -m "close branch" --close-branch; done
@ynechaev
Copy link

Unfortunately this script doesn't work when branches named with spaces, {print $1} takes first string, wich is just the first part of branch name.

@ynechaev
Copy link

I have added several changes to make this script possible close branches named with white spaces https://gist.github.com/RebornSoul/6c0a618466eade87df26#file-hg-close-inactive-branches-sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment