Skip to content

Instantly share code, notes, and snippets.

@viktorklang
Created June 30, 2015 08:43
Show Gist options
  • Save viktorklang/2316a5b32e18bd74bc8b to your computer and use it in GitHub Desktop.
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

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
Author

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

@nightscape
Copy link

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

By the way:
alias g=git
;)

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