1GIT-REVERT(1)                     Git Manual                     GIT-REVERT(1)
2
3
4

NAME

6       git-revert - Revert an existing commit
7

SYNOPSIS

9       git revert [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>
10

DESCRIPTION

12       Given one existing commit, revert the change the patch introduces, and
13       record a new commit that records it. This requires your working tree to
14       be clean (no modifications from the HEAD commit).
15
16       Note: git revert is used to record a new commit to reverse the effect
17       of an earlier commit (often a faulty one). If you want to throw away
18       all uncommitted changes in your working directory, you should see git-
19       reset(1), particularly the --hard option. If you want to extract
20       specific files as they were in another commit, you should see git-
21       checkout(1), specifically the git checkout <commit> — <filename>
22       syntax. Take care with these alternatives as both will discard
23       uncommitted changes in your working directory.
24

OPTIONS

26       <commit>
27           Commit to revert. For a more complete list of ways to spell commit
28           names, see "SPECIFYING REVISIONS" section in git-rev-parse(1).
29
30       -e, --edit
31           With this option, git revert will let you edit the commit message
32           prior to committing the revert. This is the default if you run the
33           command from a terminal.
34
35       -m parent-number, --mainline parent-number
36           Usually you cannot revert a merge because you do not know which
37           side of the merge should be considered the mainline. This option
38           specifies the parent number (starting from 1) of the mainline and
39           allows revert to reverse the change relative to the specified
40           parent.
41
42           Reverting a merge commit declares that you will never want the tree
43           changes brought in by the merge. As a result, later merges will
44           only bring in tree changes introduced by commits that are not
45           ancestors of the previously reverted merge. This may or may not be
46           what you want.
47
48           See the revert-a-faulty-merge How-To[1] for more details.
49
50       --no-edit
51           With this option, git revert will not start the commit message
52           editor.
53
54       -n, --no-commit
55           Usually the command automatically creates a commit with a commit
56           log message stating which commit was reverted. This flag applies
57           the change necessary to revert the named commit to your working
58           tree and the index, but does not make the commit. In addition, when
59           this option is used, your index does not have to match the HEAD
60           commit. The revert is done against the beginning state of your
61           index.
62
63           This is useful when reverting more than one commits´ effect to your
64           index in a row.
65
66       -s, --signoff
67           Add Signed-off-by line at the end of the commit message.
68

AUTHOR

70       Written by Junio C Hamano <gitster@pobox.com[2]>
71

DOCUMENTATION

73       Documentation by Junio C Hamano and the git-list
74       <git@vger.kernel.org[3]>.
75

GIT

77       Part of the git(1) suite
78

NOTES

80        1. revert-a-faulty-merge How-To
81           file:///usr/share/doc/git-1.7.1/howto/revert-a-faulty-merge.txt
82
83        2. gitster@pobox.com
84           mailto:gitster@pobox.com
85
86        3. git@vger.kernel.org
87           mailto:git@vger.kernel.org
88
89
90
91Git 1.7.1                         08/16/2017                     GIT-REVERT(1)
Impressum