git whereami

Update: I added git branch -a so that you can actually see where you are, and --since='2 months' so if your repo is huge like mine it doesn’t take 2 seconds to run. (The actual value of --since will probably need tweaking for your situation.)

Here’s the awesome git trick of the day:

# in ~/.gitconfig
[alias]
w = !git branch -a && git log --branches --oneline --graph --decorate --simplify-by-decoration --since='2 months ago'


$ git w
* 0bfd287 (refs/remotes/git-svn, refs/heads/foo) commit message
| * 0b5d8d4 (refs/heads/bar) another commit message
|/
| * 575185a (refs/heads/baz) YACM
|/
* b98de6b (refs/remotes/origin/master, refs/remotes/origin/HEAD) YACM
* eadfbbe initial commit message

If you’re lucky enough to have a recent version of git, the --decorate option doesn’t print out the boring refs/{remotes,heads} stuff by default.


Leave a Reply