Git tip #1: A concise `git log`

| git | 4 minute read

If you find that git log is a little too wordy for your liking, there are a number of flags that you can use to trim it down a bit.

Running git log will give you a response that looks something like this.

$ git log

commit 32eccb18fa908eb768209049f745a046b31390b4 (HEAD -> master, origin/master, origin/HEAD)
Author: Jamie Allen <jamie@email.com>
Date:   Sat Mar 30 16:11:34 2019 -0400

    Updates the darkness toggle so that it is applied to <html>

commit 7d1c6cac7a077fa8775de8be1a403c1db027cf1f
Author: Jamie Allen <jamie@email.com>
Date:   Sat Mar 30 15:48:24 2019 -0400

    Cleans up main.js and updates package name

Try git log --oneline to trim that right down. This is really handy if you want to look back at a lot of history at once.

$ git log --oneline

32eccb1 (HEAD -> master, origin/master, origin/HEAD) Updates the darkness toggle so that it is applied to <html>
7d1c6ca Cleans up main.js and updates package name

If you only want to see the commit id and message try git log --oneline --no-decorate.

$ git log --oneline --no-decorate

32eccb1 Updates the darkness toggle so that it is applied to <html>
7d1c6ca Cleans up main.js and updates package name

There are so many other useful flags you can use with git log. To learn more check out the official git docs.

Bonus tip!

Write descriptive commit messages! Your team and your future self will thank you!

Personal blog of Jamie Allen.
May contain code, ideas and thoughts.

Find me online:

Built using Gridsome. Hosted on Digital Ocean.