Search Git Commits Between Dates

By  on  

One of my weaknesses as a developer is relying on UIs to provide me the data I need.  It's not a fatal weakness but it does hamper me a bit.  One prime example is relying on GitHub's interface to review changes; git's command line provides the information needed with commands but the UI is just so much nicer.

I recently needed to trace back commits to find a problematic commit between a given date range.  You can use the following git command to list commits between two dates:

$ git log --after="2018-06-30" --before="2018-07-03" --oneline
636c0ff21 Add recordTelemetryEvent() helper to debugger util fixes #6529 (#6571)
94d5e0639 [Telemetry] Fixed telemetry import to point at devtools module using transform-mc.js (#6567)
990c52150 [Editor] get mode from editor (#6563)
2f990aa0e [flow] add types for Editor/index (#6568)
7f92836ba When replaying, fix resume button bug and show pause button when unpaused. (#6582)
1840902f9 [Breakpoint] use PureComponent (#6583)

Especially nice is the --oneline modifier to keep the commit list concise.

I'd guess that 90% of git developers simply branch, commit, and push -- not that there's anything wrong with that, but it's only about 2% of what git is capable of.  Using native tools and not UIs is a badge of honor in our business, so mastering the lessor known commands can speed up development and make you less reliant on outside apps!

Recent Features

  • By
    Create Namespaced Classes with MooTools

    MooTools has always gotten a bit of grief for not inherently using and standardizing namespaced-based JavaScript classes like the Dojo Toolkit does.  Many developers create their classes as globals which is generally frowned up.  I mostly disagree with that stance, but each to their own.  In any event...

  • By
    Responsive Images: The Ultimate Guide

    Chances are that any Web designers using our Ghostlab browser testing app, which allows seamless testing across all devices simultaneously, will have worked with responsive design in some shape or form. And as today's websites and devices become ever more varied, a plethora of responsive images...

Incredible Demos

  • By
    Create Custom Events in MooTools 1.2

    Javascript has a number of native events like "mouseover," "mouseout", "click", and so on. What if you want to create your own events though? Creating events using MooTools is as easy as it gets. The MooTools JavaScript What's great about creating custom events in MooTools is...

  • By
    Spoiler Prevention with CSS Filters

    No one likes a spoiler.  Whether it be an image from an upcoming film or the result of a football match you DVR'd, sometimes you just don't want to know.  As a possible provider of spoiler content, some sites may choose to warn users ahead...

Discussion

  1. Ruturaj

    When is Firefox gonna come natively on GIT and not hg -> git ?

  2. I totally agree with your point that it is very difficult for a developer to think outside of UIs, therefore, we need to rely on UIs. When it comes to GitHub’s interface to update or change anything like if you search Git commits between Dates then it will be very difficult for you to search due to the UIs. There are so many developers who are still confused about how to search Git commits between selected date ranges.

    The information you shared in the article will be beneficial for the developers. By using the Git command you mentioned in the blog post, one can list or search the Git commits between two dates. It is necessary for a developer to have expertise in such type of commands so that he or she will be less reliable on outside apps. Keep sharing these kinds of information with us. Thank You!

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