Skip to content

Instantly share code, notes, and snippets.

@ahmedelgabri ahmedelgabri/bbd

Last active Sep 16, 2015
Embed
What would you like to do?
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

This comment has been minimized.

Copy link

iamnewton commented Sep 16, 2015

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
You can’t perform that action at this time.