Dev Encyclopedia
ArticlesTools

Get notified when new content drops

No spam. Just new articles, tools, and updates straight to your inbox.

Dev Encyclopedia

A reference for builders

Content

  • Articles
  • Tools
  • Contact

Connect

  • support@devencyclopedia.com
  • RSS Feed

© 2026 Dev Encyclopedia

Privacy PolicyTermsDisclaimer
  1. Home
  2. /
  3. Tools
  4. /
  5. GitLogBuilder
Free · Live preview · No account

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. 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. 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. 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. 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. 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. 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.

Commit Info

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 -> f1e2d3c
Author

Who 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 ago
Committer

Who 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 -0700
Subject & Body

The 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)
References

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...
Formatting

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 message

Full placeholder reference

Every token supported by the builder above, with an example of the value it produces.

TokenMeaningExample
%HCommit hash (full)a3f5c9e2b8d14f6a7c9e0b2d4f6a8c0e2b4d6f80
%hCommit hash (abbrev)a3f5c9e
%TTree hash (full)8e4b2c1a9f7d3e5c6b8a0d2f4e6c8b0a2d4f6e80
%tTree hash (abbrev)8e4b2c1
%PParent hashes (full)f1e2d3c4b5a6978685746352413f2e1d0c9b8a7
%pParent hashes (abbrev)f1e2d3c
%anAuthor nameMaria Chen
%aeAuthor emailmaria.chen@example.com
%adAuthor dateMon Jun 8 14:32:08 2026 -0700
%arAuthor date (relative)2 hours ago
%aiAuthor date (ISO 8601)2026-06-08 14:32:08 -0700
%cnCommitter nameMaria Chen
%ceCommitter emailmaria.chen@example.com
%cdCommitter dateMon Jun 8 14:32:08 2026 -0700
%crCommitter date (relative)2 hours ago
%ciCommitter date (ISO 8601)2026-06-08 14:32:08 -0700
%sSubjectfix: handle null pointer in session middleware
%bBodyCloses #482
%BRaw bodyfix: handle null pointer in session middleware\n\nCloses #482
%NCommit notesReviewed-by: alex
%dRef names (decorated) (HEAD -> main, origin/main)
%DRef names (no wrapping)HEAD -> main, origin/main
%gdReflog selectorHEAD@{0}
%nNewline(line break)
%C(color)Color%C(yellow)

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

ScenarioSuggested format
Quick daily log while reviewing history%h %s (one-line preset)
Setting up a .gitconfig 'lg' alias%h %an %ad %s
Checking which branch/tag a commit belongs to%h%d %s
Generating a changelog from commit subjects- %s (%h)
Writing a deploy script that needs full commit info%H%n%an <%ae>%n%ai%n%n%B
Colorized output for a custom shell prompt or aliasColored compact preset

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.

TokenMeaning
%hAbbreviated commit hash
%anAuthor name
%adAuthor date
%sCommit subject
%dBranch and tag names (decorations)
How do I show the author name in git log?

Use the %an placeholder for the author's name (or %ae for their email). Combine it with %h and %s for a compact line that includes the hash, author, and commit message:

bash
git log --pretty=format:"%h %an %s"
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:

bash
git log --pretty=format:"%h %s"

💡 Tip

Click the "One-line log" preset in the builder above to load this format and see it applied to sample commits.

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.

bash
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:

bash
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 docsGitLogBuilder
FormatStatic text referenceInteractive builder
Live previewNoYes, with realistic sample commits
Copy-ready outputNoCommand and .gitconfig alias
Color codesListed onlyClick to apply, with swatches

Related reading

Guide

Claude Code Cheatsheet: Commands, Hooks & Subagents

Covers the git workflows Claude Code automates day to day. Use GitLogBuilder to craft the custom log format your scripts and aliases need.

Tool

CommitCheck: Conventional Commits Validator

Validate your commit messages against the Conventional Commits spec, then use GitLogBuilder's changelog preset to turn them into a clean changelog.

Presets

Live Preview

a3f5c9e fix: handle null pointer in session middleware
f1e2d3c feat: add CSV export to the reports dashboard
9c8b7a6 refactor: extract pagination logic into usePagination hook
5b4a392 docs: update README with new setup instructions
3a29180 chore: bump eslint and prettier to latest
1908f7e test: add coverage for auth token refresh

Commit Info

Author

Committer

Subject & Body

References

Formatting

Output

Ready-to-paste command

git log --pretty=format:"%h %s"

.gitconfig alias

·
git config --global alias.lg "log --pretty=format:'%h %s'"