Skip to content

Instantly share code, notes, and snippets.

@servel333
Last active September 26, 2022 21:24
Show Gist options
  • Save servel333/7529633 to your computer and use it in GitHub Desktop.
Save servel333/7529633 to your computer and use it in GitHub Desktop.
Nate's custom git log. One line, graphed, colored, with hash, branches, time, author and description.
## Normal git log
git log -3
# commit 58c7c712ad122bb4739a761d71684dcb23364831
# Author: Nathan Perry <[email protected]>
# Date: Wed Mar 19 22:10:39 2014 -0400
#
# Update README.md
#
# commit cd3137dad3d7debd622885445e0d117246b65603
# Author: Nathan Perry <[email protected]>
# Date: Wed Mar 19 21:54:39 2014 -0400
#
# Update README.md
#
# commit c2e7405f7a3777c15981003519a83eb8a70d6417
# Author: Nathan Perry <[email protected]>
# Date: Wed Mar 19 21:54:22 2014 -0400
#
# Update README.md
#
## --------------------
## Git abbreviated log
git config --global alias.l "log --pretty=tformat:'%h%C(bold red)%d%C(reset) %C(green)%ar%C(reset) %C(bold green)%an%C(reset) %-s' --graph --abbrev-commit"
## (There are colors here that I can't show in Markdown)
git l -3
# * 58c7c71 (HEAD, origin/master, origin/HEAD, master) 4 months ago Nathan Perry Update README.md
# * cd3137d 4 months ago Nathan Perry Update README.md
# * c2e7405 4 months ago Nathan Perry Update README.md
## --------------------
## Git abbreviated log with all commits from all branches
git config --global alias.la "log --pretty=tformat:'%h%C(bold red)%d%C(reset) %C(green)%ar%C(reset) %C(bold green)%an%C(reset) %-s' --graph --abbrev-commit --all"
## (There are colors here that I can't show in Markdown)
git la -3
# * 58c7c71 (HEAD, origin/master, origin/HEAD, master) 4 months ago Nathan Perry Update README.md
# * cd3137d 4 months ago Nathan Perry Update README.md
# * c2e7405 4 months ago Nathan Perry Update README.md
## --------------------
## Git log with absolute date
git config --global alias.ld "log --pretty=tformat:'%h%C(bold red)%d%C(reset) %C(green)%ai%C(reset) %C(bold green)%an%C(reset) %-s' --graph --abbrev-commit"
## (There are colors here that I can't show in Markdown)
git ld -3
# * 58c7c71 (HEAD, origin/master, origin/HEAD, master) 2014-03-19 22:10:39 -0400 Nathan Perry Update README.md
# * cd3137d 2014-03-19 21:54:39 -0400 Nathan Perry Update README.md
# * c2e7405 2014-03-19 21:54:22 -0400 Nathan Perry Update README.md
## --------------------
## Git long log
git config --global alias.ll "log --pretty=tformat:'%h%C(bold red)%d%C(reset) %C(green)%ar%C(reset) %C(green)%ai%C(reset)%n%C(bold normal)Author%C(reset): %C(green)%ar %ai%C(reset) %an <%ae>%n%C(bold normal)Committer%C(reset): %C(green)%cr %ci%C(reset) %cn <%ce>%+s%+b' --graph --abbrev-commit"
## (There are colors here that I can't show in Markdown)
git ll -3
# * 58c7c71 (HEAD, origin/master, origin/HEAD, master)
# | Author: 4 months ago 2014-03-19 22:10:39 -0400 Nathan Perry <[email protected]>
# | Committer: 4 months ago 2014-03-19 22:10:39 -0400 Nathan Perry <[email protected]>
# | Update README.md
# * cd3137d
# | Author: 4 months ago 2014-03-19 21:54:39 -0400 Nathan Perry <[email protected]>
# | Committer: 4 months ago 2014-03-19 21:54:39 -0400 Nathan Perry <[email protected]>
# | Update README.md
# * c2e7405
# | Author: 4 months ago 2014-03-19 21:54:22 -0400 Nathan Perry <[email protected]>
# | Committer: 4 months ago 2014-03-19 21:54:22 -0400 Nathan Perry <[email protected]>
# | Update README.md
## --------------------
## Preview time formats
git log --pretty=tformat:'%h%C(bold red)%d%C(reset) ad (%ad) aD (%aD) ar (%ar) at (%at) ai (%ai)' --graph --abbrev-commit -1
## Preview available colors
git log --pretty=tformat:'
normal: %C(normal)normal%C(reset) %C(bold normal)bold normal%C(reset) %C(dim normal)dim normal%C(reset) %C(ul normal)ul normal%C(reset) %C(reverse normal)reverse normal%C(reset) %C(blink normal)blink normal%C(reset)
black: %C(black)black%C(reset) %C(bold black)bold black%C(reset) %C(dim black)dim black%C(reset) %C(ul black)ul black%C(reset) %C(reverse black)reverse black%C(reset) %C(blink black)blink black%C(reset)
red: %C(red)red%C(reset) %C(bold red)bold red%C(reset) %C(dim red)dim red%C(reset) %C(ul red)ul red%C(reset) %C(reverse red)reverse red%C(reset) %C(blink red)blink red%C(reset)
green: %C(green)green%C(reset) %C(bold green)bold green%C(reset) %C(dim green)dim green%C(reset) %C(ul green)ul green%C(reset) %C(reverse green)reverse green%C(reset) %C(blink green)blink green%C(reset)
yellow: %C(yellow)yellow%C(reset) %C(bold yellow)bold yellow%C(reset) %C(dim yellow)dim yellow%C(reset) %C(ul yellow)ul yellow%C(reset) %C(reverse yellow)reverse yellow%C(reset) %C(blink yellow)blink yellow%C(reset)
blue: %C(blue)blue%C(reset) %C(bold blue)bold blue%C(reset) %C(dim blue)dim blue%C(reset) %C(ul blue)ul blue%C(reset) %C(reverse blue)reverse blue%C(reset) %C(blink blue)blink blue%C(reset)
magenta: %C(magenta)magenta%C(reset) %C(bold magenta)bold magenta%C(reset) %C(dim magenta)dim magenta%C(reset) %C(ul magenta)ul magenta%C(reset) %C(reverse magenta)reverse magenta%C(reset) %C(blink magenta)blink magenta%C(reset)
cyan: %C(cyan)cyan%C(reset) %C(bold cyan)bold cyan%C(reset) %C(dim cyan)dim cyan%C(reset) %C(ul cyan)ul cyan%C(reset) %C(reverse cyan)reverse cyan%C(reset) %C(blink cyan)blink cyan%C(reset)
white: %C(white)white%C(reset) %C(bold white)bold white%C(reset) %C(dim white)dim white%C(reset) %C(ul white)ul white%C(reset) %C(reverse white)reverse white%C(reset) %C(blink white)blink white%C(reset)
' -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment