Documentation / git-revert.txton commit Makefile: fix permissions of mergetools/ checked out with permissive umask (16f5bfc)
   1git-revert(1)
   2=============
   3
   4NAME
   5----
   6git-revert - Revert some existing commits
   7
   8SYNOPSIS
   9--------
  10[verse]
  11'git revert' [--edit | --no-edit] [-n] [-m parent-number] [-s] <commit>...
  12'git revert' --reset
  13'git revert' --continue
  14
  15DESCRIPTION
  16-----------
  17
  18Given one or more existing commits, revert the changes that the
  19related patches introduce, and record some new commits that record
  20them.  This requires your working tree to be clean (no modifications
  21from the HEAD commit).
  22
  23Note: 'git revert' is used to record some new commits to reverse the
  24effect of some earlier commits (often only a faulty one).  If you want to
  25throw away all uncommitted changes in your working directory, you
  26should see linkgit:git-reset[1], particularly the '--hard' option.  If
  27you want to extract specific files as they were in another commit, you
  28should see linkgit:git-checkout[1], specifically the `git checkout
  29<commit> \-- <filename>` syntax.  Take care with these alternatives as
  30both will discard uncommitted changes in your working directory.
  31
  32OPTIONS
  33-------
  34<commit>...::
  35        Commits to revert.
  36        For a more complete list of ways to spell commit names, see
  37        linkgit:gitrevisions[7].
  38        Sets of commits can also be given but no traversal is done by
  39        default, see linkgit:git-rev-list[1] and its '--no-walk'
  40        option.
  41
  42-e::
  43--edit::
  44        With this option, 'git revert' will let you edit the commit
  45        message prior to committing the revert. This is the default if
  46        you run the command from a terminal.
  47
  48-m parent-number::
  49--mainline parent-number::
  50        Usually you cannot revert a merge because you do not know which
  51        side of the merge should be considered the mainline.  This
  52        option specifies the parent number (starting from 1) of
  53        the mainline and allows revert to reverse the change
  54        relative to the specified parent.
  55+
  56Reverting a merge commit declares that you will never want the tree changes
  57brought in by the merge.  As a result, later merges will only bring in tree
  58changes introduced by commits that are not ancestors of the previously
  59reverted merge.  This may or may not be what you want.
  60+
  61See the link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for
  62more details.
  63
  64--no-edit::
  65        With this option, 'git revert' will not start the commit
  66        message editor.
  67
  68-n::
  69--no-commit::
  70        Usually the command automatically creates some commits with
  71        commit log messages stating which commits were
  72        reverted.  This flag applies the changes necessary
  73        to revert the named commits to your working tree
  74        and the index, but does not make the commits.  In addition,
  75        when this option is used, your index does not have to match
  76        the HEAD commit.  The revert is done against the
  77        beginning state of your index.
  78+
  79This is useful when reverting more than one commits'
  80effect to your index in a row.
  81
  82-s::
  83--signoff::
  84        Add Signed-off-by line at the end of the commit message.
  85
  86--strategy=<strategy>::
  87        Use the given merge strategy.  Should only be used once.
  88        See the MERGE STRATEGIES section in linkgit:git-merge[1]
  89        for details.
  90
  91-X<option>::
  92--strategy-option=<option>::
  93        Pass the merge strategy-specific option through to the
  94        merge strategy.  See linkgit:git-merge[1] for details.
  95
  96SEQUENCER SUBCOMMANDS
  97---------------------
  98include::sequencer.txt[]
  99
 100EXAMPLES
 101--------
 102`git revert HEAD~3`::
 103
 104        Revert the changes specified by the fourth last commit in HEAD
 105        and create a new commit with the reverted changes.
 106
 107`git revert -n master{tilde}5..master{tilde}2`::
 108
 109        Revert the changes done by commits from the fifth last commit
 110        in master (included) to the third last commit in master
 111        (included), but do not create any commit with the reverted
 112        changes. The revert only modifies the working tree and the
 113        index.
 114
 115SEE ALSO
 116--------
 117linkgit:git-cherry-pick[1]
 118
 119GIT
 120---
 121Part of the linkgit:git[1] suite