From f7ebbb129d592d06dfbb0af434a26c19e12551e6 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Wed, 18 Oct 2017 20:41:34 +0800 Subject: [PATCH] git-log-format: update --- git-log-format.md | 133 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 104 insertions(+), 29 deletions(-) diff --git a/git-log-format.md b/git-log-format.md index 59f61c3fd..6328bf92f 100644 --- a/git-log-format.md +++ b/git-log-format.md @@ -1,35 +1,110 @@ --- title: Git log format string category: Git +layout: 2017/sheet +updated: 2017-10-18 +weight: -1 +keywords: + - "git log --pretty=format:%H" + - "%H - Commit hash" + - "%an - Author" + - "%aD - Author date" --- - git log --pretty="format: ..." +## Log format +{: .-three-column} - %H - commit hash - %h - commit hash, abbrew - %T - tree hash - %T - tree hash, abbrev - %P - parent hash - %p - parent hash, abbrew - %an - author - %aN - author, respecting mailmap - %ae - author email - %aE - author email, respending mailmap - %aD - date (rfc2882) - %ar - date (relative) - %at - date (unix timestamp) - %ai - date (iso8601) - %cn - committer name - %cN - committer name - %ce - committer email - %cE - committer email - %cd - committer date - %cD - committer date - %cr - %ct - %ci - %cd - ref names - %e - econding - %s - commit subject - %f - commit subject, filename style - %b - commit body +### Pretty format +{: .-prime} + +```bash +git log --pretty="format:%H" +``` + +See the next tables on format variables. + +### Hash + +#### Commit + +| Variable | Description | +| --- | --- | +| `%H` | commit hash | +| `%h` | (abbrev) commit hash | + +#### Tree + +| Variable | Description | +| --- | --- | +| `%T` | tree hash | +| `%t` | (abbrev) tree hash | + +#### Parent + +| Variable | Description | +| --- | --- | +| `%P` | parent hash | +| `%p` | (abbrev) parent hash | + +### Commit + +| Variable | Description | +| --- | --- | +| `%s` | commit subject | +| `%f` | commit subject, filename style | +| `%b` | commit body | +| --- | --- | +| `%cd` | ref names | +| `%e` | encoding | + +## Author and committer + +### Author + +#### Name + +| Variable | Description | +| --- | --- | +| `%an` | author | +| `%aN` | author, respecting mailmap | + +#### Email + +| Variable | Description | +| --- | --- | +| `%ae` | author email | +| `%aE` | author email, respecting mailmap | + +#### Date + +| Variable | Description | +| --- | --- | +| `%aD` | author date (rfc2882) | +| `%ar` | author date (relative) | +| `%at` | author date (unix timestamp) | +| `%ai` | author date (iso8601) | + +### Committer + +#### Name + +| Variable | Description | +| --- | --- | +| `%cn` | committer name | +| `%cN` | committer name, respecting mailmap | + +#### Email + +| Variable | Description | +| --- | --- | +| `%ce` | committer email | +| `%cE` | committer email, respecting mailmap | + +#### Date + +| Variable | Description | +| --- | --- | +| `%cD` | committer date (rfc2882) | +| `%cr` | committer date (relative) | +| `%ct` | committer date (unix timestamp) | +| `%ci` | committer date (iso8601) |