Last active
March 27, 2020 10:15
-
-
Save b2977053/2030b160a9e4adc6caed4e113bd01f5c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
git log --pretty=format:'%Cred%h%Creset %ad |%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset [%Cgreen%an%Creset]' --abbrev-commit --date=short | |
[Commit Formatting](https://git-scm.com/docs/git-log#_commit_formatting) | |
``` | |
--graph | |
text-based graphical representation | |
--abbrev-commit | |
只顯示部分訊息 | |
--date=short | |
shows only the date, but not the time, in YYYY-MM-DD format. | |
--date | |
--date=relative | |
5 weeks ago | |
--date=raw | |
1582545807 +0800 | |
--date=unix | |
1582545807 | |
--date=iso or iso8601 | |
2020-02-24 20:03:27 +0800 | |
--date=human | |
Mon Feb 24 20:03 | |
--date=rfc or rfc2822 | |
Mon, 24 Feb 2020 20:03:27 +0800 | |
--date=format:... | |
--date=format:'%Y/%m/%d %H:%M:%S' | |
2020/02/24 20:03:27 | |
--date=format:%c | |
02/24/20 20:03:27 | |
``` | |
[PRETTY FORMATS](https://git-scm.com/docs/git-log#_pretty_formats) | |
%Cred 改成紅色 | |
%h 縮寫哈希值 | |
%Creset 重製顏色(紅色結束) | |
%ad date | |
%C(yellow) 改成黃色 | |
%d (顯示分支) | |
%Creset | |
%s 標題 | |
%Cgreen(%cr)%Creset 相對提交日期 | |
[%Cgreen%an%Creset] 使用者名稱 | |
**自訂格式** | |
1. `git log --pretty='format:%n%C(auto)%h%n%s%n%ad%n%n--- --- ----' --date=format:'%Y/%m/%d %H:%M:%S' -5` | |
2. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment