Skip to content

Instantly share code, notes, and snippets.

@fromSmolsoft
Forked from niun/set-pretty-git-log-alias.sh
Created December 12, 2024 11:22
Show Gist options
  • Save fromSmolsoft/1fab2cecf3651346bc926c78b1a08c40 to your computer and use it in GitHub Desktop.
Save fromSmolsoft/1fab2cecf3651346bc926c78b1a08c40 to your computer and use it in GitHub Desktop.

Revisions

  1. @niun niun revised this gist Nov 10, 2020. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions set-pretty-git-log-alias.sh
    Original file line number Diff line number Diff line change
    @@ -34,5 +34,4 @@ git config --global alias.lad "log --all --graph --pretty=format:'%Cgreen%ad%Cre

    ## 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
    #git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%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"
  2. @niun niun revised this gist Apr 30, 2019. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions set-pretty-git-log-alias.sh
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,9 @@
    # => <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)'"
  3. @niun niun revised this gist Mar 11, 2019. 2 changed files with 35 additions and 11 deletions.
    11 changes: 0 additions & 11 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,11 +0,0 @@
    git log --graph --branches --remotes --tags --oneline --decorate

    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
    git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'

    # declare "git la" (log graph all) alias with
    git config --global alias.la "log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'"

    # declare "git lad" (log graph all exact date) alias with
    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)'"
    35 changes: 35 additions & 0 deletions set-pretty-git-log-alias.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    ## 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 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
    #git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'
  4. @niun niun revised this gist Mar 11, 2019. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,10 @@ git log --graph --branches --remotes --tags --oneline --decorate

    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
    git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'
    git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'

    # declare "git la" (log graph all) alias with
    git config --global alias.la "log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'"

    # declare "git lad" (log graph all exact date) alias with
    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)'"
  5. @niun niun revised this gist Mar 11, 2019. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1,5 @@
    git log --pretty=format:"%h %s" --graph --branches --remotes --tags --oneline --decorate
    git log --graph --branches --remotes --tags --oneline --decorate

    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
    git log --all --graph --pretty=format:'%C(auto)%h%d %s %C(bold black)(%ar by <%aN>)%Creset'
  6. @niun niun revised this gist Sep 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    git log --pretty=format:"%h %s %t" --graph --branches --remotes --tags --oneline --decorate
    git log --pretty=format:"%h %s" --graph --branches --remotes --tags --oneline --decorate
  7. @niun niun created this gist Sep 3, 2014.
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    git log --pretty=format:"%h %s %t" --graph --branches --remotes --tags --oneline --decorate