Skip to content

Instantly share code, notes, and snippets.

@ThomasBurleson
Last active March 7, 2022 13:42
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ThomasBurleson/ffe1c914632aa105f4bdd9b18836025d to your computer and use it in GitHub Desktop.
Save ThomasBurleson/ffe1c914632aa105f4bdd9b18836025d to your computer and use it in GitHub Desktop.
Git - Improve output of commit Logs

Normal git logs commands will output a full log detail to the console;

e.g.

image

Often developers want to see a condensed listing like:

image

To generate the above format using a simple git lg command, developers create a git alias in their git configuration file:

~/.gitconfig

[alias]
  lg = log --color --graph --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

~/.bashrc

Developers can also specify a bash command log:

function log() {
  git lg
}

Terminal

Then in the terminal window, just type:

screen shot 2018-11-16 at 1 38 38 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment