Skip to content

Instantly share code, notes, and snippets.

@viktorklang
Created June 30, 2015 08:43
Show Gist options
  • Select an option

  • Save viktorklang/2316a5b32e18bd74bc8b to your computer and use it in GitHub Desktop.

Select an option

Save viktorklang/2316a5b32e18bd74bc8b to your computer and use it in GitHub Desktop.
shell alias for showing git branches sorted by last activity date
alias gbr='git for-each-ref --sort="-authordate:iso8601" --format=" %(color:green)%(authordate:iso8601)%09%(color:white)%(refname:short)" refs/heads'
@gonzaloserrano

Copy link
Copy Markdown

git has a built-in alias support so you don't need to use your shell's one (http://githowto.com/aliases) but then you need to write something like git br or whatever you like.

@viktorklang

Copy link
Copy Markdown
Author

@gonzaloserrano
Yes, indeed. In this case I opted for brevity :)

@nightscape

Copy link
Copy Markdown

The corresponding git alias (in ~/.gitconfig) would be

[alias]
   br = for-each-ref --sort='-authordate:iso8601' --format=' %(color:green)%(authordate:iso8601)%09%(color:white)%(refname:short)' refs/heads

@nightscape

Copy link
Copy Markdown

By the way:
alias g=git
;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment