Skip to content

Instantly share code, notes, and snippets.

@samiraguiar
Last active April 20, 2016 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samiraguiar/69b09416913a7eed5f6b78cc7c0b951b to your computer and use it in GitHub Desktop.
Save samiraguiar/69b09416913a7eed5f6b78cc7c0b951b to your computer and use it in GitHub Desktop.
Git: recent checked out branches
#!/bin/bash
# Outputs in the format (most recent at the bottom)
# (2016-04-15T16:08:25) branch1 -> branch2
# (2016-04-15T16:08:25) branch2 -> branch1
# (2016-04-15T16:08:25) branch2 -> branch3
git reflog --pretty="%aI %gs" | grep 'checkout: moving from' | sort | awk '{ printf "(%.19s) %-30.30s -> %s\n", $1, $5, $7}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment