-
-
Save fromSmolsoft/1fab2cecf3651346bc926c78b1a08c40 to your computer and use it in GitHub Desktop.
git log graph --oneline with date and author and colored ref names as alias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## One line per log entry with merge graph | |
## (--decorate is implicit for newer git versions?): | |
#git log --graph --oneline --decorate | |
## | | |
## Add --branches --remotes --tags --merges to see entries for all of the | |
## corresponding refs, not only commits (--all for all refs). | |
## Format output with --pretty=tformat:'<format>' | |
## Interesting placeholders for oneline <format>: | |
## %h hash (abbreviated) | |
## %d refs (like remotes, branches, tags + HEAD) in Paratheses (%D without). | |
## %s subject (tilte of commit message) | |
## %ad date given by --date=<format>. %ar is relative date (like "4 days ago") | |
## %an author name. %aN is autor name in respect of .mailmap file with aliases | |
## %Cred, %Cgreen, %Cblue start color. %Creset stop color. | |
## %C(<color>) color defined in config. %C(auto) auto color, useful for e.g. %d | |
## basic "git log --oneline": | |
#git log --pretty=tformat:'%C(auto)%h%d %s' | |
# git alias configuration: | |
# declare "git la" alias with relative date and author | |
# => <sha1> (<ref names>) <title> (<relative date> by <author>) | |
git config --global alias.la "log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'" | |
# declare "git law" alias same as "git la" but with lines wrapped | |
git config --global alias.law "log --all --graph --pretty=format:'%C(auto)%h%d %w(100,0,8)%s %C(bold black)(%ar by <%aN>)%Creset'" | |
# declare "git lad" alias with leading short-iso-like date and trailing author | |
# => <date> <sha1> (<ref names>) <title> <author> | |
git config --global alias.lad "log --all --graph --pretty=format:'%Cgreen%ad%Creset %C(auto)%h%d %s %C(bold black)<%aN>%Creset' --date=format-local:'%Y-%m-%d %H:%M (%a)'" | |
## More oneline examples: | |
#git log --all --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%ar) %C(bold blue)<%an>%Creset' | |
#git log --all --graph --pretty=format:"%ad %C(yellow)%h%Creset %s %Cblue[%an]" --date="format-local:%a %Y-%m-%d %H:%M" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment