How to commit date in "git log --all --graph --oneline --simplify-by-decoration"
Asked Answered
E

2

1

I use git log --all --graph --oneline --simplify-by-decoration to show large git commit history, but there is no commit date, what can add date?

Escheat answered 17/12, 2018 at 5:49 Comment(0)
L
6

Following seems to be the closest to what you need based on your color needs, it adds commit date per your format, check it out to see if it helps:

git log --all --graph --oneline --simplify-by-decoration --date=short --pretty=format:"%C(yellow)%h%Creset%C(red)%C(bold)%d%Creset%C(white)(%cd)%Creset %s"

For further reading and to choose from a myriad number of options check the Pretty Format docs as listed by @tymtam on the other answer above :Pretty Format docs

Liman answered 17/12, 2018 at 7:45 Comment(5)
May I set HEAD -> to cyan, local branch name to green and remote branch to red?Escheat
@Escheat try this: git log --all --graph --oneline --simplify-by-decoration --date=short --pretty=format:"%h%C(auto)%d%C(reset) %s (%an, %ar)%d%Creset%C(white)(%cd)%Creset %s" Liman
So, the above should give you the default colors for Head, local and remote branch and also has the date in your desired format(YYYY-MM-DD), inorder to play around with colors further check the docs out.Liman
Here is what I need git log --graph --all --oneline --simplify-by-decoration --date=format:%Y-%m-%d\ %H:%M:%S --pretty=format:"%C(yellow)%h%C(auto)%d% %C(white) %cd%Creset %s". Thank you very much! You gave me the hints:)Escheat
Sounds awesome 👍Liman
V
1

You can try --pretty='%h %an %aD %s'

See Pretty Formats


Update for 'I want to keep the original color and date in YYYY-MM-DD format...'

git log your_other_options --pretty='%Cgreen%h%Creset %Cblue% cd%Creset %smont' --date=short

Venlo answered 17/12, 2018 at 5:58 Comment(2)
I tried but not get the same result, can you help me?Escheat
"Pretty Formats" not "Pettty Formats". (SO won't let me edit <6 characters, perhaps the author can edit?)Hyacinthia

© 2022 - 2024 — McMap. All rights reserved.