From: Oleg Broytman Date: Mon, 29 Jun 2015 21:59:42 +0000 (+0300) Subject: Explain git revert X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=e58b976218dba56b2eaa767d09d4ddb41186d0f8;p=git-wiki.git Explain git revert --- diff --git a/pep-git.txt b/pep-git.txt index b2e3038..d42184b 100644 --- a/pep-git.txt +++ b/pep-git.txt @@ -482,8 +482,16 @@ do something like:: git revert: revert a commit --------------------------- -How to undo a merge -https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html +``git revert`` reverts a commit or commits, that is, it creates a new +commit or commits that reverts the effects of the given commits. It's +the only way to undo published commits (``git commit --amend``, ``git +rebase`` and ``git reset`` change the branch in non-fast-forwardable +ways so they should only be used for non-pushed commits.) + +There is a problem with reverting a merge commit. ``git revert`` can +undo the code created by the merge commit but it cannot undo the fact +of merge. See the discussion `How to revert a faulty merge +`_. One thing that cannot be undone -------------------------------