Displaying pretty log in git

Displaying pretty log in git git log command displays a…

git Displaying pretty log in git git log command displays a simple log which lacks important information we generally would like to be displayed. It does not tell us on which branch are we working, if we are behind or not of our master, etc. Default log displays something like this. GitDefaultLog To get a diagram displaying on which branch we are working, how many commits have been pushed by other team members between our branch and master etc, we need to edit our .gitconfig file. After we have set our git environment, and set our os to show hidden files we open a Finder window, then Go Menu -> Home.  From home we can see our .gitconfig file. GitConfig

We open the file with a text editor and insert the following lines. Any place is fine.

[alias] lg = log –graph –pretty=format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset’ –abbrev-commit –date=relative We save the file.

Go to our project bath and run the command ‘git lg’.  It will display a diagram showing merge pull requests, current branch, and all the information in a very compact way.

git lg