git-log-format: update

This commit is contained in:
Rico Sta. Cruz 2017-10-18 20:41:34 +08:00
parent 5db27db9dd
commit f7ebbb129d
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
1 changed files with 104 additions and 29 deletions

View File

@ -1,35 +1,110 @@
--- ---
title: Git log format string title: Git log format string
category: Git 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 ### Pretty format
%h - commit hash, abbrew {: .-prime}
%T - tree hash
%T - tree hash, abbrev ```bash
%P - parent hash git log --pretty="format:%H"
%p - parent hash, abbrew ```
%an - author
%aN - author, respecting mailmap See the next tables on format variables.
%ae - author email
%aE - author email, respending mailmap ### Hash
%aD - date (rfc2882)
%ar - date (relative) #### Commit
%at - date (unix timestamp)
%ai - date (iso8601) | Variable | Description |
%cn - committer name | --- | --- |
%cN - committer name | `%H` | commit hash |
%ce - committer email | `%h` | (abbrev) commit hash |
%cE - committer email
%cd - committer date #### Tree
%cD - committer date
%cr | Variable | Description |
%ct | --- | --- |
%ci | `%T` | tree hash |
%cd - ref names | `%t` | (abbrev) tree hash |
%e - econding
%s - commit subject #### Parent
%f - commit subject, filename style
%b - commit body | 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) |