Saturday 26 February 2022

git log --pretty


Useful specifiers for git log --pretty=format lists some of the more useful specifiers that format


Specifier    Description of Output

    %H        Commit hash

    %h        Abbreviated commit hash

    %T        Tree hash

    %t         Abbreviated tree hash

    %P         Parent hashes

    %p         Abbreviated parent hashes

    %an        Author name

    %ae        Author email

    %ad        Author date (format respects the --date=option)

    %ar        Author date, relative

    %cn        Committer name

    %ce        Committer email

    %cd        Committer date

    %cr        Committer date, relative

    %s         Subject


#SHA-1, author, message
git log --pretty=format:"%h - %an, %ar : %s"

git log --oneline --decorate --graph --all

git log --pretty="%h - %s" --author='Name' --since="2022-01-01"   --before="2022-26-02" --no-merges

#SHA-1, Message,Date
git log --pretty=reference

#SHA-1, author, day,month,date,time,year, message
git log --pretty=format:"%h%x09%an%x09%ad%x09%s"
git log --pretty=format:"%h%x09%an%x09%ai%x09%B"

#day,month,date,time,year, author, message
git log --pretty=" %C(reset)%ad %C(Cyan)%an: %C(reset)%s"

#SHA-1, day,month,date,time,year,hours ago, author, message
git log --pretty="%C(Yellow)%h  %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" -9

#SHA-1, time ago, message, author
git log --pretty=format:"%C(yellow)%h %ar %C(auto)%d %Creset %s , %Cblue%cn" --graph --all

create alias, add this line to your ~/.gitconfig:
list = log --pretty=format:\"%C(yellow)%h %ar %C(auto)%d %Creset %s, %Cblue%cn\" --graph --all
git list

#SHA-1, branch & origin
git show-ref --head --dereference

#SHA-1, head Ref, action, message, date
git log -g --abbrev-commit --pretty=oneline
git reflog show

No comments:

Post a Comment