Make your git log look better using a single command

👋 Introduction

Are you tired of sifting through a bland and confusing Git commit history? There's a simple yet powerful command that can give your Git log a much-needed makeover, making it both visually appealing and informative.

🚀 Getting Started

Add the following lines to your Git configuration file (usually located at ~/.gitconfig):

[alias]
gl = git log --color --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit --branches

Let's break down the command to understand its magic:

  • color: Infuses your Git log with vivid colors, making it pop.
  • graph: Generates a graphical representation of branches and merges.
  • pretty=format: Customizes the log's format to your liking.
  • %Cred%h%Creset:Displays commit hash in red.
  • %s: Displays the commit message.
  • %Cgreen(%cr): Shows the commit's relative time in green.
  • %C(bold blue)<%an>%Creset:Displays the author's name in bold blue.
  • abbrev-commit: Shortens commit hash for a cleaner look.
  • branches: Displays commits from all branches.

Upon running gl, your Git log will transform into an engaging visual journey. Each commit is highlighted with colors, and the log provides valuable insights like commit messages, author names, and relative times. The branching and merging patterns are more apparent, allowing you to follow your project's development path effortlessly.

This command is a game-changer, making your Git log not only aesthetically pleasing but also incredibly functional. Collaborate effectively, track changes efficiently, and understand your project's history at a glance.

🏁 Conclusion

Using the git log command with colourful formatting and visuals spruces up your commit history. It's a simple way to make your git log more organised and helpful, promoting better teamwork and project insight. Give it a whirl!

Github: @imevanc