/usr/share/doc/git
git-revert(1) ============= NAME ---- git-revert - Revert some existing commits SYNOPSIS -------- [verse] 'git revert' [--[no-]edit] [-n] [-m <parent-number>] [-s] [-S[<keyid>]] <commit>... 'git revert' (--continue | --skip | --abort | --quit) DESCRIPTION ----------- Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them. This requires your working tree to be clean (no modifications from the HEAD commit). Note: 'git revert' is used to record some new commits to reverse the effect of some earlier commits (often only a faulty one). If you want to throw away all uncommitted changes in your working directory, you should see linkgit:git-reset[1], particularly the `--hard` option. If you want to extract specific files as they were in another commit, you should see linkgit:git-restore[1], specifically the `--source` option. Take care with these alternatives as both will discard uncommitted changes in your working directory. See "Reset, restore and revert" in linkgit:git[1] for the differences between the three commands. OPTIONS ------- <commit>...:: Commits to revert. For a more complete list of ways to spell commit names, see linkgit:gitrevisions[7]. Sets of commits can also be given but no traversal is done by default, see linkgit:git-rev-list[1] and its `--no-walk` option. -e:: --edit:: With this option, 'git revert' will let you edit the commit message prior to committing the revert. This is the default if you run the command from a terminal. -m parent-number:: --mainline parent-number:: Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline. This option specifies the parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent. + Reverting a merge commit declares that you will never want the tree changes brought in by the merge. As a result, later merges will only bring in tree changes introduced by commits that are not ancestors of the previously reverted merge. This may or may not be what you want. + See the link:howto/revert-a-faulty-merge.html[revert-a-faulty-merge How-To] for more details. --no-edit:: With this option, 'git revert' will not start the commit message editor. --cleanup=<mode>:: This option determines how the commit message will be cleaned up before being passed on to the commit machinery. See linkgit:git-commit[1] for more details. In particular, if the '<mode>' is given a value of `scissors`, scissors will be appended to `MERGE_MSG` before being passed on in the case of a conflict. -n:: --no-commit:: Usually the command automatically creates some commits with commit log messages stating which commits were reverted. This flag applies the changes necessary to revert the named commits to your working tree and the index, but does not make the commits. In addition, when this option is used, your index does not have to match the HEAD commit. The revert is done against the beginning state of your index. + This is useful when reverting more than one commits' effect to your index in a row. -S[<keyid>]:: --gpg-sign[=<keyid>]:: --no-gpg-sign:: GPG-sign commits. The `keyid` argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space. `--no-gpg-sign` is useful to countermand both `commit.gpgSign` configuration variable, and earlier `--gpg-sign`. -s:: --signoff:: Add a `Signed-off-by` trailer at the end of the commit message. See the signoff option in linkgit:git-commit[1] for more information. --strategy=<strategy>:: Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in linkgit:git-merge[1] for details. -X<option>:: --strategy-option=<option>:: Pass the merge strategy-specific option through to the merge strategy. See linkgit:git-merge[1] for details. include::rerere-options.txt[] --reference:: Instead of starting the body of the log message with "This reverts <full-object-name-of-the-commit-being-reverted>.", refer to the commit using "--pretty=reference" format (cf. linkgit:git-log[1]). The `revert.reference` configuration variable can be used to enable this option by default. SEQUENCER SUBCOMMANDS --------------------- include::sequencer.txt[] EXAMPLES -------- `git revert HEAD~3`:: Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes. `git revert -n master~5..master~2`:: Revert the changes done by commits from the fifth last commit in master (included) to the third last commit in master (included), but do not create any commit with the reverted changes. The revert only modifies the working tree and the index. DISCUSSION ---------- While git creates a basic commit message automatically, it is _strongly_ recommended to explain why the original commit is being reverted. In addition, repeatedly reverting reverts will result in increasingly unwieldy subject lines, for example 'Reapply "Reapply "<original-subject>""'. Please consider rewording these to be shorter and more unique. CONFIGURATION ------------- include::includes/cmd-config-section-all.txt[] include::config/revert.txt[] SEE ALSO -------- linkgit:git-cherry-pick[1] GIT --- Part of the linkgit:git[1] suite
.
Edit
..
Edit
BreakingChanges.txt
Edit
CODE_OF_CONDUCT.md
Edit
DecisionMaking.html
Edit
DecisionMaking.txt
Edit
MyFirstContribution.html
Edit
MyFirstContribution.txt
Edit
MyFirstObjectWalk.html
Edit
MyFirstObjectWalk.txt
Edit
README.md
Edit
RelNotes
Edit
ReviewingGuidelines.html
Edit
ReviewingGuidelines.txt
Edit
SubmittingPatches.html
Edit
SubmittingPatches.txt
Edit
ToolsForGit.html
Edit
ToolsForGit.txt
Edit
blame-options.txt
Edit
cmds-ancillaryinterrogators.txt
Edit
cmds-ancillarymanipulators.txt
Edit
cmds-developerinterfaces.txt
Edit
cmds-foreignscminterface.txt
Edit
cmds-guide.txt
Edit
cmds-mainporcelain.txt
Edit
cmds-plumbinginterrogators.txt
Edit
cmds-plumbingmanipulators.txt
Edit
cmds-purehelpers.txt
Edit
cmds-synchelpers.txt
Edit
cmds-synchingrepositories.txt
Edit
cmds-userinterfaces.txt
Edit
config.txt
Edit
contrib
Edit
date-formats.txt
Edit
diff-format.txt
Edit
diff-generate-patch.txt
Edit
diff-options.txt
Edit
docbook-xsl.css
Edit
docinfo.html
Edit
everyday.html
Edit
fetch-options.txt
Edit
fsck-msgids.txt
Edit
git-add.html
Edit
git-add.txt
Edit
git-am.html
Edit
git-am.txt
Edit
git-annotate.html
Edit
git-annotate.txt
Edit
git-apply.html
Edit
git-apply.txt
Edit
git-archive.html
Edit
git-archive.txt
Edit
git-bisect-lk2009.html
Edit
git-bisect-lk2009.txt
Edit
git-bisect.html
Edit
git-bisect.txt
Edit
git-blame.html
Edit
git-blame.txt
Edit
git-branch.html
Edit
git-branch.txt
Edit
git-bugreport.html
Edit
git-bugreport.txt
Edit
git-bundle.html
Edit
git-bundle.txt
Edit
git-cat-file.html
Edit
git-cat-file.txt
Edit
git-check-attr.html
Edit
git-check-attr.txt
Edit
git-check-ignore.html
Edit
git-check-ignore.txt
Edit
git-check-mailmap.html
Edit
git-check-mailmap.txt
Edit
git-check-ref-format.html
Edit
git-check-ref-format.txt
Edit
git-checkout-index.html
Edit
git-checkout-index.txt
Edit
git-checkout.html
Edit
git-checkout.txt
Edit
git-cherry-pick.html
Edit
git-cherry-pick.txt
Edit
git-cherry.html
Edit
git-cherry.txt
Edit
git-clean.html
Edit
git-clean.txt
Edit
git-clone.html
Edit
git-clone.txt
Edit
git-column.html
Edit
git-column.txt
Edit
git-commit-graph.html
Edit
git-commit-graph.txt
Edit
git-commit-tree.html
Edit
git-commit-tree.txt
Edit
git-commit.html
Edit
git-commit.txt
Edit
git-config.html
Edit
git-config.txt
Edit
git-contacts.html
Edit
git-contacts.txt
Edit
git-count-objects.html
Edit
git-count-objects.txt
Edit
git-credential-cache--daemon.html
Edit
git-credential-cache--daemon.txt
Edit
git-credential-cache.html
Edit
git-credential-cache.txt
Edit
git-credential-store.html
Edit
git-credential-store.txt
Edit
git-credential.html
Edit
git-credential.txt
Edit
git-describe.html
Edit
git-describe.txt
Edit
git-diagnose.html
Edit
git-diagnose.txt
Edit
git-diff-files.html
Edit
git-diff-files.txt
Edit
git-diff-index.html
Edit
git-diff-index.txt
Edit
git-diff-tree.html
Edit
git-diff-tree.txt
Edit
git-diff.html
Edit
git-diff.txt
Edit
git-difftool.html
Edit
git-difftool.txt
Edit
git-fast-export.html
Edit
git-fast-export.txt
Edit
git-fast-import.html
Edit
git-fast-import.txt
Edit
git-fetch-pack.html
Edit
git-fetch-pack.txt
Edit
git-fetch.html
Edit
git-fetch.txt
Edit
git-filter-branch.html
Edit
git-filter-branch.txt
Edit
git-fmt-merge-msg.html
Edit
git-fmt-merge-msg.txt
Edit
git-for-each-ref.html
Edit
git-for-each-ref.txt
Edit
git-for-each-repo.html
Edit
git-for-each-repo.txt
Edit
git-format-patch.html
Edit
git-format-patch.txt
Edit
git-fsck-objects.html
Edit
git-fsck-objects.txt
Edit
git-fsck.html
Edit
git-fsck.txt
Edit
git-fsmonitor--daemon.html
Edit
git-fsmonitor--daemon.txt
Edit
git-gc.html
Edit
git-gc.txt
Edit
git-get-tar-commit-id.html
Edit
git-get-tar-commit-id.txt
Edit
git-grep.html
Edit
git-grep.txt
Edit
git-hash-object.html
Edit
git-hash-object.txt
Edit
git-help.html
Edit
git-help.txt
Edit
git-hook.html
Edit
git-hook.txt
Edit
git-http-backend.html
Edit
git-http-backend.txt
Edit
git-http-fetch.html
Edit
git-http-fetch.txt
Edit
git-http-push.html
Edit
git-http-push.txt
Edit
git-imap-send.html
Edit
git-imap-send.txt
Edit
git-index-pack.html
Edit
git-index-pack.txt
Edit
git-init-db.html
Edit
git-init-db.txt
Edit
git-init.html
Edit
git-init.txt
Edit
git-interpret-trailers.html
Edit
git-interpret-trailers.txt
Edit
git-log.html
Edit
git-log.txt
Edit
git-ls-files.html
Edit
git-ls-files.txt
Edit
git-ls-remote.html
Edit
git-ls-remote.txt
Edit
git-ls-tree.html
Edit
git-ls-tree.txt
Edit
git-mailinfo.html
Edit
git-mailinfo.txt
Edit
git-mailsplit.html
Edit
git-mailsplit.txt
Edit
git-maintenance.html
Edit
git-maintenance.txt
Edit
git-merge-base.html
Edit
git-merge-base.txt
Edit
git-merge-file.html
Edit
git-merge-file.txt
Edit
git-merge-index.html
Edit
git-merge-index.txt
Edit
git-merge-one-file.html
Edit
git-merge-one-file.txt
Edit
git-merge-tree.html
Edit
git-merge-tree.txt
Edit
git-merge.html
Edit
git-merge.txt
Edit
git-mergetool--lib.html
Edit
git-mergetool--lib.txt
Edit
git-mergetool.html
Edit
git-mergetool.txt
Edit
git-mktag.html
Edit
git-mktag.txt
Edit
git-mktree.html
Edit
git-mktree.txt
Edit
git-multi-pack-index.html
Edit
git-multi-pack-index.txt
Edit
git-mv.html
Edit
git-mv.txt
Edit
git-name-rev.html
Edit
git-name-rev.txt
Edit
git-notes.html
Edit
git-notes.txt
Edit
git-pack-objects.html
Edit
git-pack-objects.txt
Edit
git-pack-redundant.html
Edit
git-pack-redundant.txt
Edit
git-pack-refs.html
Edit
git-pack-refs.txt
Edit
git-patch-id.html
Edit
git-patch-id.txt
Edit
git-prune-packed.html
Edit
git-prune-packed.txt
Edit
git-prune.html
Edit
git-prune.txt
Edit
git-pull.html
Edit
git-pull.txt
Edit
git-push.html
Edit
git-push.txt
Edit
git-quiltimport.html
Edit
git-quiltimport.txt
Edit
git-range-diff.html
Edit
git-range-diff.txt
Edit
git-read-tree.html
Edit
git-read-tree.txt
Edit
git-rebase.html
Edit
git-rebase.txt
Edit
git-receive-pack.html
Edit
git-receive-pack.txt
Edit
git-reflog.html
Edit
git-reflog.txt
Edit
git-refs.html
Edit
git-refs.txt
Edit
git-remote-ext.html
Edit
git-remote-ext.txt
Edit
git-remote-fd.html
Edit
git-remote-fd.txt
Edit
git-remote-helpers.html
Edit
git-remote.html
Edit
git-remote.txt
Edit
git-repack.html
Edit
git-repack.txt
Edit
git-replace.html
Edit
git-replace.txt
Edit
git-replay.html
Edit
git-replay.txt
Edit
git-request-pull.html
Edit
git-request-pull.txt
Edit
git-rerere.html
Edit
git-rerere.txt
Edit
git-reset.html
Edit
git-reset.txt
Edit
git-restore.html
Edit
git-restore.txt
Edit
git-rev-list.html
Edit
git-rev-list.txt
Edit
git-rev-parse.html
Edit
git-rev-parse.txt
Edit
git-revert.html
Edit
git-revert.txt
Edit
git-rm.html
Edit
git-rm.txt
Edit
git-send-pack.html
Edit
git-send-pack.txt
Edit
git-sh-i18n--envsubst.html
Edit
git-sh-i18n--envsubst.txt
Edit
git-sh-i18n.html
Edit
git-sh-i18n.txt
Edit
git-sh-setup.html
Edit
git-sh-setup.txt
Edit
git-shell.html
Edit
git-shell.txt
Edit
git-shortlog.html
Edit
git-shortlog.txt
Edit
git-show-branch.html
Edit
git-show-branch.txt
Edit
git-show-index.html
Edit
git-show-index.txt
Edit
git-show-ref.html
Edit
git-show-ref.txt
Edit
git-show.html
Edit
git-show.txt
Edit
git-sparse-checkout.html
Edit
git-sparse-checkout.txt
Edit
git-stage.html
Edit
git-stage.txt
Edit
git-stash.html
Edit
git-stash.txt
Edit
git-status.html
Edit
git-status.txt
Edit
git-stripspace.html
Edit
git-stripspace.txt
Edit
git-submodule.html
Edit
git-submodule.txt
Edit
git-switch.html
Edit
git-switch.txt
Edit
git-symbolic-ref.html
Edit
git-symbolic-ref.txt
Edit
git-tag.html
Edit
git-tag.txt
Edit
git-tools.html
Edit
git-tools.txt
Edit
git-unpack-file.html
Edit
git-unpack-file.txt
Edit
git-unpack-objects.html
Edit
git-unpack-objects.txt
Edit
git-update-index.html
Edit
git-update-index.txt
Edit
git-update-ref.html
Edit
git-update-ref.txt
Edit
git-update-server-info.html
Edit
git-update-server-info.txt
Edit
git-upload-archive.html
Edit
git-upload-archive.txt
Edit
git-upload-pack.html
Edit
git-upload-pack.txt
Edit
git-var.html
Edit
git-var.txt
Edit
git-verify-commit.html
Edit
git-verify-commit.txt
Edit
git-verify-pack.html
Edit
git-verify-pack.txt
Edit
git-verify-tag.html
Edit
git-verify-tag.txt
Edit
git-version.html
Edit
git-version.txt
Edit
git-web--browse.html
Edit
git-web--browse.txt
Edit
git-whatchanged.html
Edit
git-whatchanged.txt
Edit
git-worktree.html
Edit
git-worktree.txt
Edit
git-write-tree.html
Edit
git-write-tree.txt
Edit
git.html
Edit
git.txt
Edit
gitattributes.html
Edit
gitattributes.txt
Edit
gitcli.html
Edit
gitcli.txt
Edit
gitcore-tutorial.html
Edit
gitcore-tutorial.txt
Edit
gitcredentials.html
Edit
gitcredentials.txt
Edit
gitdiffcore.html
Edit
gitdiffcore.txt
Edit
giteveryday.html
Edit
giteveryday.txt
Edit
gitfaq.html
Edit
gitfaq.txt
Edit
gitformat-bundle.html
Edit
gitformat-bundle.txt
Edit
gitformat-chunk.html
Edit
gitformat-chunk.txt
Edit
gitformat-commit-graph.html
Edit
gitformat-commit-graph.txt
Edit
gitformat-index.html
Edit
gitformat-index.txt
Edit
gitformat-pack.html
Edit
gitformat-pack.txt
Edit
gitformat-signature.html
Edit
gitformat-signature.txt
Edit
gitglossary.html
Edit
gitglossary.txt
Edit
githooks.html
Edit
githooks.txt
Edit
gitignore.html
Edit
gitignore.txt
Edit
gitmailmap.html
Edit
gitmailmap.txt
Edit
gitmodules.html
Edit
gitmodules.txt
Edit
gitnamespaces.html
Edit
gitnamespaces.txt
Edit
gitpacking.html
Edit
gitpacking.txt
Edit
gitprotocol-capabilities.html
Edit
gitprotocol-capabilities.txt
Edit
gitprotocol-common.html
Edit
gitprotocol-common.txt
Edit
gitprotocol-http.html
Edit
gitprotocol-http.txt
Edit
gitprotocol-pack.html
Edit
gitprotocol-pack.txt
Edit
gitprotocol-v2.html
Edit
gitprotocol-v2.txt
Edit
gitremote-helpers.html
Edit
gitremote-helpers.txt
Edit
gitrepository-layout.html
Edit
gitrepository-layout.txt
Edit
gitrevisions.html
Edit
gitrevisions.txt
Edit
gitsubmodules.html
Edit
gitsubmodules.txt
Edit
gittutorial-2.html
Edit
gittutorial-2.txt
Edit
gittutorial.html
Edit
gittutorial.txt
Edit
gitworkflows.html
Edit
gitworkflows.txt
Edit
glossary-content.txt
Edit
howto
Edit
howto-index.html
Edit
howto-index.txt
Edit
i18n.txt
Edit
line-range-format.txt
Edit
line-range-options.txt
Edit
merge-options.txt
Edit
merge-strategies.txt
Edit
mergetools-diff.txt
Edit
mergetools-merge.txt
Edit
object-format-disclaimer.txt
Edit
pretty-formats.txt
Edit
pretty-options.txt
Edit
pull-fetch-param.txt
Edit
ref-reachability-filters.txt
Edit
ref-storage-format.txt
Edit
rerere-options.txt
Edit
rev-list-description.txt
Edit
rev-list-options.txt
Edit
revisions.txt
Edit
scalar.html
Edit
scalar.txt
Edit
sequencer.txt
Edit
signoff-option.txt
Edit
technical
Edit
trace2-target-values.txt
Edit
transfer-data-leaks.txt
Edit
urls-remotes.txt
Edit
urls.txt
Edit
user-manual.html
Edit
user-manual.txt
Edit