GIT 1.4.3-rc1
[git.git] / Documentation / git-blame.txt
blob9891c1d3779185c200345c0e6d92763aa155a169
1 git-blame(1)
2 ============
4 NAME
5 ----
6 git-blame - Show what revision and author last modified each line of a file
8 SYNOPSIS
9 --------
10 'git-blame' [-c] [-l] [-t] [-f] [-n] [-p] [-S <revs-file>] [--] <file> [<rev>]
12 DESCRIPTION
13 -----------
15 Annotates each line in the given file with information from the revision which
16 last modified the line. Optionally, start annotating from the given revision.
18 This report doesn't tell you anything about lines which have been deleted or
19 replaced; you need to use a tool such as gitlink:git-diff[1] or the "pickaxe"
20 interface briefly mentioned in the following paragraph.
22 Apart from supporting file annotation, git also supports searching the
23 development history for when a code snippet occured in a change. This makes it
24 possible to track when a code snippet was added to a file, moved or copied
25 between files, and eventually deleted or replaced. It works by searching for
26 a text string in the diff. A small example:
28 -----------------------------------------------------------------------------
29 $ git log --pretty=oneline -S'blame_usage'
30 5040f17eba15504bad66b14a645bddd9b015ebb7 blame -S <ancestry-file>
31 ea4c7f9bf69e781dd0cd88d2bccb2bf5cc15c9a7 git-blame: Make the output
32 -----------------------------------------------------------------------------
34 OPTIONS
35 -------
36 -c, --compatibility::
37         Use the same output mode as gitlink:git-annotate[1] (Default: off).
39 -l, --long::
40         Show long rev (Default: off).
42 -t, --time::
43         Show raw timestamp (Default: off).
45 -S, --rev-file <revs-file>::
46         Use revs from revs-file instead of calling gitlink:git-rev-list[1].
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.
53 -n, --show-number::
54         Show line number in the original commit (Default: off).
56 -p, --porcelain::
57         Show in a format designed for machine consumption.
59 -h, --help::
60         Show help message.
63 THE PORCELAIN FORMAT
64 --------------------
66 In this format, each line is output after a header; the
67 header at the minumum has the first line which has:
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.
76 This header line is followed by the following information
77 at least once for each commit:
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").
85 The contents of the actual line is output after the above
86 header, prefixed by a TAB. This is to allow adding more
87 header elements later.
89 SEE ALSO
90 --------
91 gitlink:git-annotate[1]
93 AUTHOR
94 ------
95 Written by Fredrik Kuivinen <freku045@student.liu.se>.
97 GIT
98 ---
99 Part of the gitlink:git[7] suite