DEV Community

Cover image for How This Simple glp Alias Saves Hours in Git
TechWithTy
TechWithTy

Posted on • Edited on

How This Simple glp Alias Saves Hours in Git

🚨 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
Enter fullscreen mode Exit fullscreen mode
Fixed login bug
Enter fullscreen mode Exit fullscreen mode

💀 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'"
Enter fullscreen mode Exit fullscreen mode

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.
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

😍 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.
Enter fullscreen mode Exit fullscreen mode

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'"
Enter fullscreen mode Exit fullscreen mode

➝ 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'"
Enter fullscreen mode Exit fullscreen mode

➝ 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"
Enter fullscreen mode Exit fullscreen mode

➝ 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: https://github.com/techwithty

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay