Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save praveen-krishn/1235f3684a06f06a1f2503773efbdd9f to your computer and use it in GitHub Desktop.

Select an option

Save praveen-krishn/1235f3684a06f06a1f2503773efbdd9f to your computer and use it in GitHub Desktop.
Too many crusty old git branches? Run this to find likely candidates for deletion. It lists all the remote branches and sorts them by age.
#!/bin/sh
#
# Too many crusty old git branches? Run this to find likely candidates for deletion
# It lists all the remote branches and sorts them by age.
#
#for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%ci %cr %cn " $k|head -n 1`\\t$k;done|sort -r
for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%Cgreen%ci %Cblue%cr %Cred%cn %Creset" $k|head -n 1`\\t$k;done|sort -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment