Skip to content

Instantly share code, notes, and snippets.

@ahmedelgabri
Last active September 16, 2015 06:22
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 ahmedelgabri/2684c4578c3fe5990c5a to your computer and use it in GitHub Desktop.
Save ahmedelgabri/2684c4578c3fe5990c5a to your computer and use it in GitHub Desktop.
A script to list branches by date http://davidwalsh.name/git-branches-date
#!/bin/sh
#
# Usage: bbd "Sep 14"
# bbd "Sep"
git reflog --date=local | grep "$1 .* checkout: moving from .* to" | grep -o "[a-zA-Z0-9\-]*$" | sort | uniq
@iamnewton
Copy link

If you name this something like git-bbd and put it in your $PATH, then you can call in the context of git such as git bbd Sep. Doesn't necessarily improve the script but does keep it within the git ecosystem. Or you could put this in your git aliases as such and call it the same way:

git config --global alias.bbd  !bash -c 'git reflog --date=local | grep "$1 .* checkout: moving from .* to" | grep -o "[a-zA-Z0-9\-]*$" | sort | uniq'

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