Build your perfect git log format in 30 seconds.
Stop scrolling through git-scm docs to remember %h vs %H. Click the placeholders you want, see what real commits look like with your format, and copy the finished command.
How GitLogBuilder works
- 1
Start from a preset or a blank format string
Pick one of the six presets (one-line, with author and date, with branch decoration, full with body, colored compact, or changelog) or start typing your own format string from scratch.
- 2
Click placeholders to add them
The placeholder picker lists every git log --pretty=format: token, grouped by category: commit info, author, committer, subject and body, references, and formatting. Clicking one appends it to your format string.
- 3
Search to find a placeholder fast
Type into the search box to filter the picker by token, name, or description: e.g. typing 'date' shows %ad, %ar, %ai, %cd, %cr, and %ci.
- 4
Optionally wrap a placeholder in color
Pick a color from the 'Wrap in color' dropdown before clicking a placeholder. It inserts the token pre-wrapped in %C(color) ... %C(reset) so your terminal output is colorized.
- 5
Watch the live preview update instantly
The preview panel renders six realistic sample commits using your current format string, including line breaks from %n and colors from %C(), exactly as they would appear in your terminal.
- 6
Copy the command or the .gitconfig alias
The Output section gives you a ready-to-paste git log --pretty=format:"..." command, plus a git config --global alias.<name> command using the same format. Set your alias name and copy either one.
What each placeholder category means
Every placeholder belongs to one of six categories. Knowing the category helps you find the right token fast: dates and names live under Author or Committer, the message lives under Subject & Body, and branch/tag info lives under References.
The identity of the commit and its place in the DAG: full and abbreviated hashes for the commit, its tree, and its parent(s). Use %h for everyday log output and %H when you need a stable, full-length identifier (e.g. for linking to a commit on GitHub).
git log --pretty=format:"%h -> %p"
# a3f5c9e -> f1e2d3cWho originally wrote the change and when. The author stays the same even if the commit is later rebased or cherry-picked onto a new branch by someone else. %ar (relative date, like '2 hours ago') is the most readable choice for humans; %ai (ISO 8601) is the most reliable for scripts.
git log --pretty=format:"%an <%ae> - %ar"
# Maria Chen <maria.chen@example.com> - 2 hours agoWho applied the commit to the repository and when. This often matches the author, but differs after a rebase, cherry-pick, or merge: the committer is whoever ran that operation, while the author stays the original writer.
git log --pretty=format:"%h committed by %cn on %cd"
# a3f5c9e committed by Maria Chen on Mon Jun 8 14:32:08 2026 -0700The actual commit message. %s is just the first line (the subject), perfect for one-line logs and changelogs. %B includes the full message body, useful when you need the complete context, like 'Closes #482' from a multi-line commit.
git log --pretty=format:"- %s (%h)"
# - fix: handle null pointer in session middleware (a3f5c9e)Branch names, tags, and HEAD position pointing at this commit. %d adds a leading space and parentheses (good for appending to a line); %D gives the raw names without wrapping (good when you want to format it yourself).
git log --pretty=format:"%h%d %s"
# a3f5c9e (HEAD -> main, origin/main) fix: handle null pointer...Tokens that control layout rather than print commit data. %n inserts a newline, useful for multi-line per-commit output. %C(color) and %C(reset) control terminal color, letting you highlight specific fields like the hash or author.
git log --pretty=format:"%C(yellow)%h%C(reset)%n%an%n%n%B"
# yellow hash on its own line, then author, then a blank line, then the full messageFull placeholder reference
Every token supported by the builder above, with an example of the value it produces.
| Token | Meaning |
|---|---|
| %H | Commit hash (full) |
| %h | Commit hash (abbrev) |
| %T | Tree hash (full) |
| %t | Tree hash (abbrev) |
| %P | Parent hashes (full) |
| %p | Parent hashes (abbrev) |
| %an | Author name |
| %ae | Author email |
| %ad | Author date |
| %ar | Author date (relative) |
| %ai | Author date (ISO 8601) |
| %cn | Committer name |
| %ce | Committer email |
| %cd | Committer date |
| %cr | Committer date (relative) |
| %ci | Committer date (ISO 8601) |
| %s | Subject |
| %b | Body |
| %B | Raw body |
| %N | Commit notes |
| %d | Ref names (decorated) |
| %D | Ref names (no wrapping) |
| %gd | Reflog selector |
| %n | Newline |
| %C(color) | Color |
Color tokens take a parameter: %C(red), %C(green), %C(yellow), %C(blue), %C(magenta), %C(cyan), %C(white), %C(bold), and %C(reset).
When to use GitLogBuilder
| Scenario |
|---|
| Quick daily log while reviewing history |
| Setting up a .gitconfig 'lg' alias |
| Checking which branch/tag a commit belongs to |
| Generating a changelog from commit subjects |
| Writing a deploy script that needs full commit info |
| Colorized output for a custom shell prompt or alias |
Frequently Asked Questions
What are git log format placeholders?
Format placeholders are the %-prefixed tokens you put inside git log --pretty=format:"..." to control exactly which pieces of commit data are printed and in what order. For example, %h prints the abbreviated commit hash and %an prints the author's name.
Without a format string, git log prints a fixed, multi-line block for every commit. With --pretty=format:, you choose exactly what appears on each line, which makes it useful for scripts, changelogs, and custom aliases.
| Token | Meaning |
|---|---|
| %h | Abbreviated commit hash |
| %an | Author name |
| %ad | Author date |
| %s | Commit subject |
| %d | Branch and tag names (decorations) |
How do I make git log show one line per commit?
The classic one-line format is the abbreviated hash followed by the subject. This is also what git log --oneline does internally:
git log --pretty=format:"%h %s"How do I add color to git log output?
Wrap any placeholder in %C(color) ... %C(reset). The color applies to everything between the two until %C(reset) (or another %C()) is seen. Supported color names include red, green, yellow, blue, magenta, cyan, white, and bold.
git log --pretty=format:"%C(yellow)%h%C(reset) %C(blue)%ad%C(reset) %C(green)%an%C(reset) %s"In the builder above, pick a color from the "Wrap in color" dropdown before clicking a placeholder, and it inserts the placeholder pre-wrapped with the color codes.
How do I create a git log alias in .gitconfig?
Use git config --global alias.<name> with the same log --pretty=format: string, but with single quotes around the format so it works correctly inside .gitconfig:
git config --global alias.lg "log --pretty=format:'%h %an %ad %s'"After running this once, git lg runs your custom format. The Output section of the builder above generates this command for you, including a configurable alias name.
Does GitLogBuilder send any data to a server?
No. GitLogBuilder runs entirely in your browser. The placeholder list, preset formats, and sample commit data used for the live preview are all bundled with the page. Nothing you type is sent anywhere, and the tool works offline once loaded.
How is this different from the git-scm.com format reference?
| git-scm.com docs | GitLogBuilder | |
|---|---|---|
| Format | Static text reference | Interactive builder |
| Live preview | No | Yes, with realistic sample commits |
| Copy-ready output | No | Command and .gitconfig alias |
| Color codes | Listed only | Click to apply, with swatches |