Martin Vegter
Martin Vegter

Reputation: 527

save git log date format in .gitconfig

I can specify custom date format for git log

git log --reverse --date=format:'%Y-%b-%d %H:%M:%S' 

but when I try to save this in .gitconfig, it has no effect

[format]
  date = format:'%Y-%b-%d %H:%M:%S'

How can I customize my date format in .gitconfig ? also, how can I save --reverse in .gitconfig ?

Upvotes: 2

Views: 170

Answers (1)

Samvel Petrosov
Samvel Petrosov

Reputation: 7696

Try specifying date=format for log command and not format as below

[log]
  date = format:'%Y-%b-%d %H:%M:%S'

For specifying --reverse you can use alias like below:

[log]
    date=format:'%Y-%b-%d %H:%M:%S' 
[alias]
    lg = log --reverse

After these changes your git log will print with the specified format and when you write git lg will be printed git log with --reverse.

Upvotes: 2

Related Questions