๐จ STOP using git log
the old way! ๐จ
If youโre constantly drowning in a flood of commit hashes, author names, dates, and long messagesโyouโre doing it wrong.
I used to type git log
like a caveman, getting lost in a sea of unnecessary info. Then I found a BETTER way.
๐ก Meet glp
โA Custom Alias That Makes Git Logs Insanely Easier
โ
What Makes glp
Awesome?
- Compact & Clean โ No more overwhelming walls of text.
- Color-coded for Clarity โ Instantly spot commit hashes, authors, and times.
-
Relative Time Awareness โ See commits as
"5 minutes ago"
instead of a full timestamp.
โ The Problem With git log
By default, git log
is a cluttered mess. Hereโs what you usually get:
commit 87fd12a3b2a45e8df8347d8d4fa0023bd4a5e987
Author: John Doe <johndoe@example.com>
Date: Tue Feb 13 12:34:56 2024 +0000
Fixed login bug
๐ Looks complicated and takes forever to read!
โก The Game-Changer: A Cleaner Git Log (glp)
Instead of using git log, create a custom alias that makes commit logs readable and useful.
๐ง How to Set Up glp
Add this one-liner to your .bashrc or .zshrc file:
alias glp="git log --pretty=format:'%C(yellow)%h%Creset - %C(green)%an%Creset - %C(cyan)%ar%Creset - %s'"
What it does:
โ
Shows only the commit hash, author, relative time, and message.
โ
Adds color coding for quick scanning.
โ
Displays times as "5 minutes ago" instead of a long timestamp.
Now, instead of running git log, just type:
glp
And youโll get this instead:
1a2b3c - John Doe - 5 minutes ago - Fixed login bug
4d5e6f - Jane Smith - 2 days ago - Updated UI layout
7g8h9i - Dev Ops - 1 week ago - Optimized database query
๐ So much cleaner, right?!
๐ Why This Saves You Hours
No more scrolling endlessly through an unreadable commit history.
Easier debugging โ Quickly find the last few commits at a glance.
Faster collaboration โ See recent changes by teammates instantly.
Better PR Reviews โ Scan commits effortlessly before merging.
Imagine checking commits 10+ times a dayโthis trick saves minutes per check, adding up to hours every month! ๐
๐ Bonus: More Git Log Customization
Want to tweak the alias further? Here are some cool variations:
1๏ธโฃ Show Branch & Tags
alias glp="git log --decorate --pretty=format:'%C(yellow)%h%Creset %d - %C(green)%an%Creset - %C(cyan)%ar%Creset - %s'"
โ Displays branch/tag info in the log.
2๏ธโฃ Limit to Last 5 Commits
alias glp="git log -n 5 --pretty=format:'%C(yellow)%h%Creset - %C(green)%an%Creset - %C(cyan)%ar%Creset - %s'"
โ Shows only the latest 5 commits.
3๏ธโฃ Show Full Timestamp Instead of Relative Time
alias glp="git log --pretty=format:'%C(yellow)%h%Creset - %C(green)%an%Creset - %C(cyan)%ad%Creset - %s' --date=iso"
โ Displays full timestamps instead of "5 minutes ago".
Final Thoughts
Stop using git log the old way!
This simple alias transforms your Git workflow, making commit logs more readable, concise, and useful.
Try it out, tweak it to your liking, and share it with your fellow devs! ๐จโ๐ป๐ฅ
๐ฌ What do you think? Drop a comment if you found this usefulโor share your own favorite Git productivity tricks! ๐
๐ Need More Dev Productivity Tips?
Follow me for more coding hacks, Git tips, and DevOps tricks! ๐
๐ Find me on Youtube: @techwithty
๐ GitHub: github.com/techwithty
Top comments (0)