2014-10-07 07:52:58 +00:00
|
|
|
---
|
|
|
|
title: Git log format string
|
2015-11-24 04:30:17 +00:00
|
|
|
category: Git
|
2020-07-05 11:11:36 +00:00
|
|
|
updated: 2017-10-18
|
2017-10-18 12:41:34 +00:00
|
|
|
weight: -1
|
|
|
|
keywords:
|
|
|
|
- "git log --pretty=format:%H"
|
|
|
|
- "%H - Commit hash"
|
|
|
|
- "%an - Author"
|
|
|
|
- "%aD - Author date"
|
2014-10-07 07:52:58 +00:00
|
|
|
---
|
|
|
|
|
2017-10-18 12:41:34 +00:00
|
|
|
## Log format
|
|
|
|
{: .-three-column}
|
|
|
|
|
|
|
|
### 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 |
|
|
|
|
| --- | --- |
|
2018-11-07 21:37:18 +00:00
|
|
|
| `%d` | ref names |
|
2017-10-18 12:41:34 +00:00
|
|
|
| `%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 |
|
|
|
|
| --- | --- |
|
2022-07-07 12:55:40 +00:00
|
|
|
| `%cD` | committer date (rfc2822) |
|
2017-10-18 12:41:34 +00:00
|
|
|
| `%cr` | committer date (relative) |
|
|
|
|
| `%ct` | committer date (unix timestamp) |
|
|
|
|
| `%ci` | committer date (iso8601) |
|
2017-10-18 12:44:41 +00:00
|
|
|
|
|
|
|
## Also see
|
|
|
|
|
|
|
|
- [Git log cheatsheet](./git-log)
|