index-pack: be careful after fixing up the header/footer
[git/dscho.git] / Documentation / git-revert.txt
blobcaa07298a6b6c0ea2fe2257cb2c62fcae2e62d46
1 git-revert(1)
2 =============
4 NAME
5 ----
6 git-revert - Revert an existing commit
8 SYNOPSIS
9 --------
10 'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
12 DESCRIPTION
13 -----------
14 Given one existing commit, revert the change the patch introduces, and record a
15 new commit that records it.  This requires your working tree to be clean (no
16 modifications from the HEAD commit).
18 Note: 'git revert' is used to record a new commit to reverse the
19 effect of an earlier commit (often a faulty one).  If you want to
20 throw away all uncommitted changes in your working directory, you
21 should see linkgit:git-reset[1], particularly the '--hard' option.  If
22 you want to extract specific files as they were in another commit, you
23 should see linkgit:git-checkout[1], specifically the 'git checkout
24 <commit> -- <filename>' syntax.  Take care with these alternatives as
25 both will discard uncommitted changes in your working directory.
27 OPTIONS
28 -------
29 <commit>::
30         Commit to revert.
31         For a more complete list of ways to spell commit names, see
32         "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
34 -e::
35 --edit::
36         With this option, 'git-revert' will let you edit the commit
37         message prior to committing the revert. This is the default if
38         you run the command from a terminal.
40 -m parent-number::
41 --mainline parent-number::
42         Usually you cannot revert a merge because you do not know which
43         side of the merge should be considered the mainline.  This
44         option specifies the parent number (starting from 1) of
45         the mainline and allows revert to reverse the change
46         relative to the specified parent.
48 --no-edit::
49         With this option, 'git-revert' will not start the commit
50         message editor.
52 -n::
53 --no-commit::
54         Usually the command automatically creates a commit with
55         a commit log message stating which commit was
56         reverted.  This flag applies the change necessary
57         to revert the named commit to your working tree
58         and the index, but does not make the commit.  In addition,
59         when this option is used, your index does not have to match
60         the HEAD commit.  The revert is done against the
61         beginning state of your index.
63 This is useful when reverting more than one commits'
64 effect to your index in a row.
66 -s::
67 --signoff::
68         Add Signed-off-by line at the end of the commit message.
71 Author
72 ------
73 Written by Junio C Hamano <gitster@pobox.com>
75 Documentation
76 --------------
77 Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
79 GIT
80 ---
81 Part of the linkgit:git[1] suite