Make git log great again!
This trick is a better way to show and visualize git history in the command line. Working in anywhere git runs.
This is the command to do it
Copy this command and paste into your git working directory:
1 |
git log --topo-order --all --graph --date=local --pretty=format:'%C(green)%h%C(reset) %><(55,trunc)%s%C(red)%d%C(reset) %C(blue)[%an]%C(reset) %C(yellow)%ad%C(reset)%n' |
That’s all, right? But I have some magic with this trick. Moving on!
Create an alias in ~/.gitconfig for confident using
After this step, you can call the whole command above just by “git lg” instead of g
it log.
- Open .gitconfig file in any text editor. (nano, vim, notepad, MSWord, etc.)
- Add command below the [alias] section.
- The entire file might look like this:
1 2 3 4 5 |
[user] name = JK. KyTs email = [email protected] [alias] lg = log --topo-order --all --graph --date=local --pretty=format:'%C(green)%h%C(reset) %><(55,trunc)%s%C(red)%d%C(reset) %C(blue)[%an]%C(reset) %C(yellow)%ad%C(reset)%n' |
BE CAREFULL: If these steps are too complex, follow the best practice I mention hereafter.
Best practice:
Copy and paste to your terminal, one-time setup forever!
1 |
git config --global alias.lg "log --topo-order --all --graph --date=local --pretty=format:'%C(green)%h%C(reset) %><(55,trunc)%s%C(red)%d%C(reset) %C(blue)[%an]%C(reset) %C(yellow)%ad%C(reset)%n'" |
Now, cd into your git working directory and type: git lg
Thanks to codingforeverybody.com with ♥
Subscribe
Login
1 Comment
Most Voted