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

  • By
    I’m an Impostor

    This is the hardest thing I've ever had to write, much less admit to myself.  I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life.  All of those feelings were very...

  • By
    5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My trip to Mozilla Summit 2013 was incredible.  I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out.  MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...

Incredible Demos

  • By
    CSS Custom Cursors

    Remember the Web 1.0 days where you had to customize your site in every way possible?  You abused the scrollbars in Internet Explorer, of course, but the most popular external service I can remember was CometCursor.  CometCursor let you create and use loads of custom cursors for...

  • By
    TextboxList for MooTools and jQuery by Guillermo Rauch

    I'll be honest with you: I still haven't figured out if I like my MooTools teammate Guillermo Rauch. He's got a lot stacked up against him. He's from Argentina so I get IM'ed about 10 times a day about how great Lionel...

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!