Quick git Commit Searching

By  on  

While I love GitHub for the way it presents git repository information to me, I've been trying hard not to rely so much on GUI web apps and desktop apps, instead looking to use command line equivalents.  You see that in my recent shell posts, including Tweet from Command Line with tHow to Watermark Images and VideosAccess Mac Camera by Command Line, and more.  The command line is magic™!

One frequent git task is searching a list of commits on master branch which match a given keyword.  Here's how I do that:

git log -i --grep='ckeditor'

In the command above, I'm searching the commit log for commits and/or authors that relate to CKEditor, a component of MDN that I frequently update.  A sample result would look like:

commit 1d5dfd86633488873326774819c0e7b362fadfb0
Merge: 84a271c 4f0a7e3
Author: John Karahalis <redacted@gmail.com>
Date:   Thu Aug 20 15:59:37 2015 -0400

    Merge pull request #3425 from darkwing/1196252-ckeditor

    fix bug 1196252 - Upgrade CKEditor to 4.5.3

commit 4f0a7e3602058079bdc9ab7fad3cfd0513596045
Author: David Walsh <redacted@gmail.com>
Date:   Wed Aug 19 09:49:34 2015 -0500

    fix bug 1196252 - Upgrade CKEditor to 4.5.3

commit 4e55f36f58a1f792bd8869c2c97cecb2951e5afa
Merge: 57a7c2a cda134e
Author: luke crouch <redacted@gmail.com>
Date:   Thu Jul 2 13:15:33 2015 -0500

    Merge pull request #3302 from darkwing/975868-ckeditor-upgrade-2

    Bug 975868 - Upgrade CKEditor to 4.4.8

:

I love being able to see this result quickly within the command line instead of having to open my browser, navigate to GitHub, use their search, etc.  We all know git is super powerful -- we should aim to use each feature!

Recent Features

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

  • By
    An Interview with Eric Meyer

    Your early CSS books were instrumental in pushing my love for front end technologies. What was it about CSS that you fell in love with and drove you to write about it? At first blush, it was the simplicity of it as compared to the table-and-spacer...

Incredible Demos

  • By
    Face Detection with jQuery

    I've always been intrigued by recognition software because I cannot imagine the logic that goes into all of the algorithms. Whether it's voice, face, or other types of detection, people look and sound so different, pictures are shot differently, and from different angles, I...

  • By
    Assign Anchor IDs Using MooTools 1.2

    One of my favorite uses of the MooTools JavaScript library is the SmoothScroll plugin. I use it on my website, my employer's website, and on many customer websites. The best part about the plugin is that it's so easy to implement. I recently ran...

Discussion

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