Skip to content

Instantly share code, notes, and snippets.

@BYK
Created August 12, 2015 10:57
Show Gist options
  • Save BYK/66dfd985491b483bd140 to your computer and use it in GitHub Desktop.
Save BYK/66dfd985491b483bd140 to your computer and use it in GitHub Desktop.
import itertools
import operator
get_branches = lambda: [branch[1:].strip() for branch in $(git branch --list).split('\n') if branch]
get_remotes = lambda: dict((k, set(v[1] for v in group)) for k, group in itertools.groupby(branch.split('->')[0].split('/') for branch in $(git branch -r).split(), operator.itemgetter(0)) if k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment