git log format

Git log out of the default format is not particularly intuitive, very often want a more convenient output more or less information, here are a few of git log format.
You can customize according to their needs.

a git log command accepts a --pretty options to determine the output format.

such as:

If we want to output hash.

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

Detailed command:

  • %H: commit hash
  • % H: shortened commit hash
  • %T: tree hash
  • % T: shortened tree hash
  • %P: parent hashes
  • % P: shortened parent hashes
  • % An: Author Name
  • % aN: mailmap name of the author (.mailmap correspondence, details referring to git-shortlog (1) or git-blame says (1) )
  • % Ae: Author mailbox
  • % aE: OF mailbox (.mailmap corresponds details with reference to git-shortlog (1) or Git-blame says (. 1) )
  • % Ad: Date (--date = format developed)
  • % AD: date, RFC2822 format
  • % Ar: date, relative format (1 day ago)
  • % At: date, UNIX timestamp
  • % Ai: date, ISO 8601 format
  • % Cn: the name of the submitter
  • % cN: the name of the submitter (.mailmap corresponds details with reference to git-shortlog (1) or Git-blame says (. 1) )
  • % Ce: submitter email
  • % cE: submitter email (.mailmap corresponds details with reference to git-shortlog (1) or Git-blame says (. 1) )
  • % Cd: submit (--date = format developed) Date
  • % CD: filing date, RFC2822 format
  • % Cr: filing date, the relative format (1 day ago)
  • % Ct: filing date, UNIX timestamp
  • % Ci: filing date, ISO 8601 format
  • % D: ref name
  • %e: encoding
  • % S: commit Title
  • %f: sanitized subject line, suitable for a filename
  • % B: commit content
  • %N: commit notes
  • %gD: reflog selector, e.g., refs/stash@{1}
  • %gd: shortened reflog selector, e.g., stash@{1}
  • %gs: reflog subject
  • % Cred: switch to red
  • % Cgreen: switch to green
  • % Cblue: Switch to blue
  • % Creset: Color Reset
  • % C (...): the development of color, as described in color.branch * config option.
  • %m: left, right or boundary mark
  • % N: newline
  • %%: a raw %
  • %x00: print a byte from a hex code
  • %w([[,[,]]]): switch line wrapping, like the -w option of git-shortlog(1)

 

Guess you like

Origin www.cnblogs.com/ckAng/p/11205055.html