Skip to content

Instantly share code, notes, and snippets.

@jethroo
Last active February 22, 2016 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jethroo/779a591d5da90229c66b to your computer and use it in GitHub Desktop.
Save jethroo/779a591d5da90229c66b to your computer and use it in GitHub Desktop.
deletes all local branches with no changes in 1 week
for k in $(git branch | sed /\*/d | grep '../..'); do
if [ -n "$(git log -1 --since='1 week ago' -s $k)" ]; then
echo keeping $k;
else
git branch -D $k;
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment