TIL - Episode 4. Configuring GIT timeline views.
Ever wonder how you can easily check out your git timeline locally, without having to use a GUI or have to go to Github? Yeah, there is an easy way.
You can configure your global config to this:
[format]
pretty = %ad %Cred%h%Creset %C(yellow)%d%Creset %s <%Cgreen%an%Creset>
[log]
decorate = short
I’ve been using this since my time at Customer.io. Thanks to Stephen for showing me this!.
This will produce a timeline like:
For information around formatting, check out the --format
flag documentation.
If you’d prefer to avoid creating a global configuration for viewing your timeline, you can easily
use --oneline
and --graph
flags in your terminal, thanks to Chris Achard for this one!
Want to see something cool?
— Chris Achard (@chrisachard) November 8, 2019
Open a terminal to an active git project you have, and type:
git log --oneline --graph
🤯
So what does this command do?
git log --oneline --graph
Let’s break it down:
The git documentation specifies that --oneline
is just a shortcut for:
--pretty=oneline --abbrev-commit
In practice, it looks like this:
git log --pretty=oneline --abbrev-commit --graph
Finally, what does --graph
do? Again, going back to git’s documentation:
Draw a text-based graphical representation of the commit history on the left hand side of the output.
Basically, *
is used to represent a single line in your timeline.
Alright! Thank you for reading my learnings from today. Did you learn something new? Anything here that I got wrong or can improve on? Let me know at @alvincrespo.
Cheers!
Jump to top of page