Git
commit message
command line
console display
terminal tips

Show full Git commit message in console without having to resize the window

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

If Git is only showing the first line of a commit message, the problem is usually the command format, not the terminal size. The fix is to ask Git for the full body and let a pager such as less handle scrolling or wrapping instead of relying on --oneline output.

Show One Full Commit Message

The most direct command for a single commit is git show with a custom format. %B means the raw body, including the subject line and any blank lines in the commit message.

bash
git show -s --format=%B HEAD

That prints only the commit message for HEAD. You can replace HEAD with any commit hash, branch, or tag.

If you also want author and date information, use a fuller format:

bash
git show -s --format=fuller HEAD

This is usually easier than resizing the terminal because Git sends the output through a pager automatically when it is longer than one screen.

Show Full Messages in git log

Many people lose the message body because they are using git log --oneline, which intentionally shows only the subject. Switch to a format that includes the body:

bash
git log --format=medium -n 5

Or use an explicit custom format:

bash
git log --format='%h%nAuthor: %an%nDate: %ad%n%n%B%n' -n 5

That format prints the abbreviated hash, author, date, and full commit body for each entry. The blank lines are deliberate because they make multiple commits easier to read.

Let the Pager Do the Work

The pager is what makes long commit messages readable in a narrow terminal. Git normally uses less, which allows you to move up and down without resizing the window.

Useful pager controls:

  • 'j and k move line by line'
  • space moves forward one page
  • 'b moves backward one page'
  • '/ searches within the output'
  • 'q exits the pager'

If long lines are being cut off rather than wrapped, your pager flags may be disabling wrapping. You can override the pager for a command:

bash
git -c core.pager='less -+S' show -s --format=%B HEAD

The -+S part turns line chopping off, which allows wrapping again. That is useful when commit bodies contain long URLs or wide text.

Sometimes you want the full message in a script, a pipe, or a copied snippet. In that case, disable the pager and print the body directly:

bash
git --no-pager show -s --format=%B HEAD

That is especially handy when you want to pass the message into another command or inspect it in a terminal multiplexer pane.

Make It Easy to Reuse

If you do this often, add a Git alias so you do not have to remember the full format string every time.

bash
git config --global alias.msg 'show -s --format=%B'
git config --global alias.msgfull 'show -s --format=fuller'

Then you can run:

bash
git msg HEAD
git msgfull 2f4c9d1

Aliases are a clean way to standardize this across repositories without changing project config files.

Common Pitfalls

The biggest source of confusion is git log --oneline. It is designed for compact history browsing, so it only shows the first line of the message by design.

Another issue is pager configuration. If less is running with -S, long lines are chopped horizontally. That makes it seem like Git is hiding text even when the full message is actually present.

Some users also expect %s and %B to behave the same way. They do not. %s is only the subject line, while %B is the full raw message body.

Finally, if the message itself was written as a single very long line, wrapping depends on the pager and terminal behavior. Git cannot invent line breaks that were never in the commit message.

Summary

  • Use git show -s --format=%B <commit> to print the full commit message body.
  • Avoid --oneline when you need more than the subject line.
  • Let the pager handle scrolling instead of resizing the terminal.
  • If wrapping is disabled, override the pager with less -+S.
  • Create a Git alias if you inspect full commit messages frequently.

Course illustration
Course illustration

All Rights Reserved.