Skip to content

Instantly share code, notes, and snippets.

@tsabat
Created May 9, 2016 18:37
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 tsabat/f05862b3c95996ba2c9666ec7710d597 to your computer and use it in GitHub Desktop.
Save tsabat/f05862b3c95996ba2c9666ec7710d597 to your computer and use it in GitHub Desktop.

I use this to list my branches by name. If you want to reusue it, change the grep /ts to grep /yournamespace

function branches() {
  git for-each-ref --sort=-committerdate refs/heads/ | grep /ts | awk '{print $3}' |  sed 's|refs/heads/||g'
}

function branches_all() {
  git for-each-ref --sort=-committerdate refs/heads/ | awk '{print $3}' |  sed 's|refs/heads/||g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment