Skip to content

Instantly share code, notes, and snippets.

@cbrammer
Created October 3, 2010 22:13
Show Gist options
  • Save cbrammer/608997 to your computer and use it in GitHub Desktop.
Save cbrammer/608997 to your computer and use it in GitHub Desktop.
// Regex to parse "git branch -a -vv"
(\*)? +(.*?) +(.*?)? ((\[(.*?)(: (.*?) (\d+))?\])? ?(.*$))?
// 0 the whole thing
// 1 if there is a * (active)
// 2 branch name
// optional after this
// 3 most recent commit short sha
// 4-5 ignore
// 6 tracking brack name
// 7 where it is in relation to the tracking branch, ignore
// 8 ahead or behind
// 9 how many ahead or mehing
// 10 most recent commit message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment