Open book with Git branch and cloud

Git Show

What is git-show?

git-show is a command line utility that is used to view expanded details on Git objects such as blobs, trees, tags, and commits. git-show has specific behavior per object type.

Tags show the tag message and other objects included in the tag. Trees show the names and content of objects in a tree. Blobs show the direct content of the blob. Commits show a commit log message and a diff output of the changes in the commit.

Git objects are all accessed by references. By default, git-show acts against the HEAD reference. The HEAD reference always points to the last commit of the current branch. Therefore, you can use git-show to display the log message and diff output of the latest commit.

Git-show options

A reference to an object or a list of objects may be passed to examine those specific objects. If no explicit objects are passed, git-show defaults to the HEAD reference.

The pretty option takes a secondary format value that can be one of: oneline, short, medium, full, fuller, email, raw, and format:. If omitted, the format defaults to medium. Each format option is a different template for how Git formats the show output. The oneline option can be very helpful for showing a list of commits

This option shortens the length of output commit IDs. Commit IDs are 40 characters long and can be hard to view on narrow terminal screens. This option combined with --pretty=oneline can produce a highly succinct git log output.

Always Show the full 40 character commit ID. This will ignore --abbrev-commit and any other options that abbreviate commit IDs like the --oneline format

This is a shortcut for using the expanded command --pretty=oneline --abbrev-commit

Character encoding on Git log messages defaults to UTF-8. The encoding option can change to a different character encoding output. This is useful if you are working with Git in an environment with different character encoding, like an Asian language terminal.


These options replace tab characters with spaces in the log message output. The n value can be set to configure how many space characters the tabs expand to. Without an explicit n value tabs will expand to 8 spaces. --no-expand-tabs is equivalent to n=0


Git has a note system that enables arbitrary ‘note’ metadata to be attached to objects. This data can be hidden or filtered when using git-show

This option will validate the commit is signed with an encrypted signature by passing it to a gpg subcommand.

Pretty formats for git-show

The --pretty option discussed above accepts several secondary options to massage the format of git-show output. These secondary options are listed below with example template

  • oneline
    </code></li> </ul> <p>Oneline attempts to compact as much info into a single line as possible</p> <ul> <li><strong>short</strong><br /> <code>commit <sha1><br /> Author: <author><br /> <title line></code></li> </ul> <ul> <li><strong>medium</strong><br /> <code>commit <sha1><br /> Author: <author><br /> Date: <author date><br /> <title line><br /> <full commit message></code></li> </ul> <ul> <li><strong>full</strong><br /> <code>commit <sha1><br /> Author: <author><br /> Commit: <committer><br /> <title line><br /> <full commit message></code></li> </ul> <ul> <li><strong>fuller</strong><br /> <code>commit <sha1><br /> Author: <author><br /> AuthorDate: <author date><br /> Commit: <committer><br /> CommitDate: <committer date><br /> <title line><br /> <full commit message></code></li> </ul> <ul> <li><b>email</b><br /> <code>From <sha1> <date><br /> From: <author><br /> Date: <author date><br /> Subject: [PATCH] <title line><br /> <full commit message></code></li> </ul> <ul> <li><strong>raw</strong><br /> <strong>raw</strong> format ignores other direct formatting options passed to <code>git-show</code> and outputs the commit exactly as stored in the object. Raw will disregard <code>--abrev</code> and <code>--no-abbrev</code> and always show the parent commits.</code></li> </ul> <ul> <li><strong>format:</strong><br /> format enables the specification of a custom output format. It works similar to the C language’s <code>printf</code> command. The <code>--pretty=format</code> option takes a secondary value of a template string. The template has access to placeholder variables that will be filled with data from the commit object. These placeholders are listed below:<br /> <br /> • <em>%H</em>: commit hash<br /> • <em>%h</em>: abbreviated commit hash<br /> • <em>%T</em>: tree hash<br /> • <em>%t</em>: abbreviated tree hash<br /> • <em>%P</em>: parent hashes<br /> •<em> %p</em>: abbreviated parent hashes<br /> •<em> %an</em>: author name<br /> • <em>%aN</em>: author name <br /> • <em>%ae</em>: author email<br /> • <em>%aE</em>: author email <br /> •<em> %ad</em>: author date (format respects --date= option)<br /> •<em> %aD</em>: author date, RFC2822 style<br /> • <em>%ar</em>: author date, relative<br /> •<em> %at</em>: author date, UNIX timestamp<br /> •<em> %ai</em>: author date, ISO 8601 format<br /> <em>• %cn</em>: committer name<br /> • <em>%cN</em>: committer name <br /> • <em>%ce</em>: committer email<br /> • <em>%cE</em>: committer email <br /> •<em> %cd</em>: committer date<br /> • <em>%cD</em>: committer date, RFC2822 style<br /> •<em> %cr</em>: committer date, relative<br /> • <em>%ct</em>: committer date, UNIX timestamp<br /> •<em> %ci</em>: committer date, ISO 8601 format<br /> •<em> %d</em>: ref names, like the --decorate option of git-log(1)<br /> •<em> %e</em>: encoding<br /> •<em> %s</em>: subject<br /> •<em> %f</em>: sanitized subject line, suitable for a filename<br /> <em>• %b</em>: body<br /> •<em> %N</em>: commit notes<br /> •<em> %gD</em>: reflog selector, e.g., refs/stash@{1}<br /> •<em> %gd</em>: shortened reflog selector, e.g., stash@{1}<br /> • <em>%gs</em>: reflog subject<br /> • <em>%Cred</em>: switch color to red<br /> •<em> %Cgreen</em>: switch color to green<br /> • <em>%Cblue</em>: switch color to blue<br /> • <em>%Creset</em>: reset color<br /> • <em>%C(...)</em>: color specification, as described in color.branch.* config option<br /> •<em> %m</em>: left, right or boundary mark<br /> • <em>%n</em>: newline<br /> • <em>%%</em>: a raw %<br /> • <em>%x00</em>: print a byte from a hex code<br /> • <em>%w([<w>[,<i1>[,<i2>]]])</em>: switch line wrapping, like the -w option of git-shortlog</li> </ul> <h3 > Examples of git-show </h3> <div class="component component--codeblock"> <pre><code>git show --pretty="" --name-only bd61ad98</code></pre> </div> <script type="text/x-component"> { "type":"imkt.wpl.CodeBlock", "params": { } } </script> <p>This will list all the files that were touched in a commit</p> <div class="component component--codeblock"> <pre><code>git show REVISION:path/to/file</code></pre> </div> <script type="text/x-component"> { "type":"imkt.wpl.CodeBlock", "params": { } } </script> <p>This will show a specific version of a file. Replace the <code>REVISON</code> with a Git sha.</p> <div class="component component--codeblock"> <pre><code>git show v2.0.0 6ef002d74cbbc099e1063728cab14ef1fc49c783</code></pre> </div> <script type="text/x-component"> { "type":"imkt.wpl.CodeBlock", "params": { } } </script> <p>This will show the v2.0.0 tag and also commit at <code>6ef002d74cbbc099e1063728cab14ef1fc49c783</code></p> <div class="component component--codeblock"> <pre><code>git show commitA...commitD</code></pre> </div> <script type="text/x-component"> { "type":"imkt.wpl.CodeBlock", "params": { } } </script> <p>This will output all commits in the range from <code>commitA</code> to <code>commit D</code></p> <h3 > Summary </h3> <p><code>git-show</code> is a very versatile command for examining objects in a Git repo. It can be used to target specific files at specific revisions. Examining a commit range with <code>git-show</code> will output all the individual commits between the range. <code>git-show</code> can be a helpful tool for creating patch notes and tracking changes in a repository.</p> </div></div> </div> </div> </div> <div id="footer" class="footer is-tutorial "> <div class="g-row _atlassian-logo"> <div class="g-column g-12-12"> <h5 > Powered By </h5> <a href="" class="cms-link cms-link--image" ><img src="" loading="lazy" alt="Atlassian"></a> </div></div> <div class="g-row"> <div class="g-column g-4-12 t-12-12 m-12-12 t-gutterless"> <h6 > Recommend </h6> <a href="" class="cms-link cms-link--image social-code" ><img src="" loading="lazy" alt="Twitter"></a> <a href="" class="cms-link cms-link--image social-code" ><img src="" loading="lazy" alt="Facebook"></a> <a href="" class="cms-link cms-link--image social-code" ><img src="" loading="lazy" alt="GooglePlus"></a> </div><div class="g-column g-4-12 t-12-12 m-12-12 t-gutterless"> <h6 > Want future articles? </h6> <form class="newsletter"> <input class="is-empty _input" type="email" placeholder="Enter Your Email For Git News"> <button type="submit" class="_status icon-email-submit">Submit</button> </form> </div><div class="g-column g-4-12 t-12-12 m-12-12 t-gutterless"> <h6 > Site hosted by </h6> <a href="/ko/" class="cms-link cms-link--image" ><img src="" loading="lazy" alt="Bitbucket" class="_bitbucket-logo"></a> </div></div> <div class="g-row"> <div class="g-column g-12-12 t-12-12 m-12-12"> <p class="license"><a class="icon-global-cclicense" href="" data-event="clicked" data-uuid="028d468a-75" data-event-component="linkButton" data-event-container="richText" data-schema-version="1" data-product-key="bitbucket" data-event="clicked" data-uuid="028d468a-75" data-event-component="linkButton" data-event-container="richText" data-schema-version="1" data-product-key="bitbucket" rel="nofollow"></a>Except where otherwise noted, all content is licensed under a <a href="" data-event="clicked" data-uuid="028d468a-75" data-event-component="linkButton" data-event-container="richText" data-schema-version="1" data-product-key="bitbucket" data-event="clicked" data-uuid="028d468a-75" data-event-component="linkButton" data-event-container="richText" data-schema-version="1" data-product-key="bitbucket" rel="nofollow">Creative Commons Attribution 2.5 Australia License</a>.</p> <style type="text/css">.tutorial-sidebar ._group > a:hover { color: #ccc !important; } .tutorial-sidebar ._group-wrap > a:hover, .tutorial-sidebar ._toc > a:hover { color: #fff; } </style> </div></div> </div> <script type="text/javascript"> var HTTP_PREFIX = ""; var FEATURE_FLAG_USE_GDPR = true; </script> <script type="text/javascript" src=""></script> <link rel="stylesheet" href="" /> <script type="text/javascript"> (function(){ var imkt = window.imkt || (window.imkt = {}); imkt.isEditMode = false; imkt.isProduction = true; imkt.constants = imkt.constants || {}; imkt.constants.rootPath = "/"; imkt.constants.assetPath = "" + "/assets/"; imkt.constants.libPath = imkt.constants.assetPath + "bower_components/"; imkt.constants.cdnVersionQuery = "?cdnVersion=1597"; imkt.constants.isDevUser = false; imkt.constants.isFreeEnabled = true; imkt.constants.getUserAccounts = false; imkt.constants.headerLoginMenu = true; imkt.constants.public = true; imkt.constants.mobileBreakpoint = 640; })(); </script> <script type="text/x-component"> { "type":"imkt.pages.WACPage", "params": { } } </script> <script> function initializeATLAnalytics() { var pageViewProperties = { contentSite: 'Git Microsite', contentType: 'Microsite', contentProduct: 'Bitbucket' }; /* get url path, convert to dash format and add it to page view properties. */ var originProduct = window.location.pathname; pageViewProperties.originProduct = "wac" + (originProduct === '/' ? "" : originProduct.replace(new RegExp('/', 'g'),"-")); if (typeof ace !== 'undefined') {'kiv6wyh2nw', pageViewProperties, null, null, window.atlGlobalLoadStart); } } </script> <script type = "text/javascript"> /** * function to load external js through javascript. * * @param url - javascript url * @param location - location of the dom (e.g. document.head) */ var loadExternalJS = function(url, location, callback){ var scriptTag = document.createElement('script'); scriptTag.src = url; scriptTag.type = 'text/javascript'; /* Then bind the event to the callback function. There are several events for cross browser compatibility. */ scriptTag.onreadystatechange = callback; scriptTag.onload = callback; window.atlGlobalLoadStart = new Date(); /* Fire the loading */ location.appendChild(scriptTag); }; </script> <script type="text/javascript" class="optanon-category-2"> loadExternalJS("", document.body, initializeATLAnalytics); </script> </body> <!-- LastRendered: 2021. 5. 11 오후 4:53:14 --> </html>