Documentation / git-blame.txton commit Merge branch 'jc/web-blame' (8e95026)
   1git-blame(1)
   2============
   3
   4NAME
   5----
   6git-blame - Show what revision and author last modified each line of a file
   7
   8SYNOPSIS
   9--------
  10'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [-S <revs-file>] [--] <file> [<rev>]
  11
  12DESCRIPTION
  13-----------
  14
  15Annotates each line in the given file with information from the revision which
  16last modified the line. Optionally, start annotating from the given revision.
  17
  18This report doesn't tell you anything about lines which have been deleted or
  19replaced; you need to use a tool such as gitlink:git-diff[1] or the "pickaxe"
  20interface briefly mentioned in the following paragraph.
  21
  22Apart from supporting file annotation, git also supports searching the
  23development history for when a code snippet occured in a change. This makes it
  24possible to track when a code snippet was added to a file, moved or copied
  25between files, and eventually deleted or replaced. It works by searching for
  26a text string in the diff. A small example:
  27
  28-----------------------------------------------------------------------------
  29$ git log --pretty=oneline -S'blame_usage'
  305040f17eba15504bad66b14a645bddd9b015ebb7 blame -S <ancestry-file>
  31ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output
  32-----------------------------------------------------------------------------
  33
  34OPTIONS
  35-------
  36-c, --compatibility::
  37        Use the same output mode as gitlink:git-annotate[1] (Default: off).
  38
  39-l, --long::
  40        Show long rev (Default: off).
  41
  42-t, --time::
  43        Show raw timestamp (Default: off).
  44
  45-S, --rev-file <revs-file>::
  46        Use revs from revs-file instead of calling gitlink:git-rev-list[1].
  47
  48-f, --show-name::
  49        Show filename in the original commit.  By default
  50        filename is shown if there is any line that came from a
  51        file with different name, due to rename detection.
  52
  53-n, --show-number::
  54        Show line number in the original commit (Default: off).
  55
  56-p, --porcelain::
  57        Show in a format designed for machine consumption.
  58
  59-h, --help::
  60        Show help message.
  61
  62
  63THE PORCELAIN FORMAT
  64--------------------
  65
  66In this format, each line is output after a header; the
  67header at the minumum has the first line which has:
  68
  69- 40-byte SHA-1 of the commit the line is attributed to;
  70- the line number of the line in the original file;
  71- the line number of the line in the final file;
  72- on a line that starts a group of line from a different
  73  commit than the previous one, the number of lines in this
  74  group.  On subsequent lines this field is absent.
  75
  76This header line is followed by the following information
  77at least once for each commit:
  78
  79- author name ("author"), email ("author-mail"), time
  80  ("author-time"), and timezone ("author-tz"); similarly
  81  for committer.
  82- filename in the commit the line is attributed to.
  83- the first line of the commit log message ("summary").
  84
  85The contents of the actual line is output after the above
  86header, prefixed by a TAB. This is to allow adding more
  87header elements later.
  88
  89SEE ALSO
  90--------
  91gitlink:git-annotate[1]
  92
  93AUTHOR
  94------
  95Written by Fredrik Kuivinen <freku045@student.liu.se>.
  96
  97GIT
  98---
  99Part of the gitlink:git[7] suite