Get Git Branches Checked Out on a Date

By  on  

I don't use any type of git UI -- I try to be hardcore and stick to the command line.  This makes git usage quicker but I also probably miss out on a lot of the functionality that would be nice to know.  The functionality is there, of course, but without a nice icon or menu item you don't really think about it.

I was browsing CommandLineFu and found a nice git snippet which provides you a listing of branches checked out on a given date:

git reflog --date=local | grep "Sep 10 .* checkout: moving from .* to" | grep -o "[a-zA-Z0-9\-]*$" | sort | uniq

I love this snippet because I often forget recently created branch names (...grow up and delete old branches, David!), especially when leaving work for the weekend.  Handy!

Recent Features

Incredible Demos

  • By
    MooTools History Plugin

    One of the reasons I love AJAX technology so much is because it allows us to avoid unnecessary page loads.  Why download the header, footer, and other static data multiple times if that specific data never changes?  It's a waste of time, processing, and bandwidth.  Unfortunately...

  • By
    Fancy Navigation with MooTools JavaScript

    Navigation menus are traditionally boring, right? Most of the time the navigation menu consists of some imagery with a corresponding mouseover image. Where's the originality? I've created a fancy navigation menu that highlights navigation items and creates a chain effect. The XHTML Just some simple...

Discussion

  1. That was really helpful. I created a script “branches by date” to make it easier to use, I hope that someone will find it useful. https://gist.github.com/ahmedelgabri/2684c4578c3fe5990c5a

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!