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

NAME

6       git-revert - Revert some existing commits
7

SYNOPSIS

9       git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
10       git revert --continue
11       git revert --quit
12       git revert --abort
13
14

DESCRIPTION

16       Given one or more existing commits, revert the changes that the related
17       patches introduce, and record some new commits that record them. This
18       requires your working tree to be clean (no modifications from the HEAD
19       commit).
20
21       Note: git revert is used to record some new commits to reverse the
22       effect of some earlier commits (often only a faulty one). If you want
23       to throw away all uncommitted changes in your working directory, you
24       should see git-reset(1), particularly the --hard option. If you want to
25       extract specific files as they were in another commit, you should see
26       git-checkout(1), specifically the git checkout <commit> -- <filename>
27       syntax. Take care with these alternatives as both will discard
28       uncommitted changes in your working directory.
29

OPTIONS

31       <commit>...
32           Commits to revert. For a more complete list of ways to spell commit
33           names, see gitrevisions(7). Sets of commits can also be given but
34           no traversal is done by default, see git-rev-list(1) and its
35           --no-walk option.
36
37       -e, --edit
38           With this option, git revert will let you edit the commit message
39           prior to committing the revert. This is the default if you run the
40           command from a terminal.
41
42       -m parent-number, --mainline parent-number
43           Usually you cannot revert a merge because you do not know which
44           side of the merge should be considered the mainline. This option
45           specifies the parent number (starting from 1) of the mainline and
46           allows revert to reverse the change relative to the specified
47           parent.
48
49           Reverting a merge commit declares that you will never want the tree
50           changes brought in by the merge. As a result, later merges will
51           only bring in tree changes introduced by commits that are not
52           ancestors of the previously reverted merge. This may or may not be
53           what you want.
54
55           See the revert-a-faulty-merge How-To[1] for more details.
56
57       --no-edit
58           With this option, git revert will not start the commit message
59           editor.
60
61       -n, --no-commit
62           Usually the command automatically creates some commits with commit
63           log messages stating which commits were reverted. This flag applies
64           the changes necessary to revert the named commits to your working
65           tree and the index, but does not make the commits. In addition,
66           when this option is used, your index does not have to match the
67           HEAD commit. The revert is done against the beginning state of your
68           index.
69
70           This is useful when reverting more than one commits' effect to your
71           index in a row.
72
73       -S[<keyid>], --gpg-sign[=<keyid>]
74           GPG-sign commits. The keyid argument is optional and defaults to
75           the committer identity; if specified, it must be stuck to the
76           option without a space.
77
78       -s, --signoff
79           Add Signed-off-by line at the end of the commit message. See the
80           signoff option in git-commit(1) for more information.
81
82       --strategy=<strategy>
83           Use the given merge strategy. Should only be used once. See the
84           MERGE STRATEGIES section in git-merge(1) for details.
85
86       -X<option>, --strategy-option=<option>
87           Pass the merge strategy-specific option through to the merge
88           strategy. See git-merge(1) for details.
89

SEQUENCER SUBCOMMANDS

91       --continue
92           Continue the operation in progress using the information in
93           .git/sequencer. Can be used to continue after resolving conflicts
94           in a failed cherry-pick or revert.
95
96       --quit
97           Forget about the current operation in progress. Can be used to
98           clear the sequencer state after a failed cherry-pick or revert.
99
100       --abort
101           Cancel the operation and return to the pre-sequence state.
102

EXAMPLES

104       git revert HEAD~3
105           Revert the changes specified by the fourth last commit in HEAD and
106           create a new commit with the reverted changes.
107
108       git revert -n master~5..master~2
109           Revert the changes done by commits from the fifth last commit in
110           master (included) to the third last commit in master (included),
111           but do not create any commit with the reverted changes. The revert
112           only modifies the working tree and the index.
113

SEE ALSO

115       git-cherry-pick(1)
116

GIT

118       Part of the git(1) suite
119

NOTES

121        1. revert-a-faulty-merge How-To
122           file:///usr/share/doc/git/howto/revert-a-faulty-merge.html
123
124
125
126Git 2.21.0                        02/24/2019                     GIT-REVERT(1)
Impressum