{
    "content": [
        {
            "type": "text",
            "text": "# git-revert (info)\n\n## NAME\n\ngit-revert - Revert some existing commits\n\n## SYNOPSIS\n\ngit revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\ngit revert (--continue | --skip | --abort | --quit)\n\n## DESCRIPTION\n\nGiven one or more existing commits, revert the changes that the related\npatches introduce, and record some new commits that record them. This\nrequires your working tree to be clean (no modifications from the HEAD\ncommit).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (5 subsections)\n- **SEQUENCER SUBCOMMANDS** (4 subsections)\n- **EXAMPLES**\n- **SEE ALSO**\n- **GIT**\n- **NOTES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "git-revert",
        "section": "",
        "mode": "info",
        "summary": "git-revert - Revert some existing commits",
        "synopsis": "git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\ngit revert (--continue | --skip | --abort | --quit)",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-e",
                "long": "--edit",
                "arg": null,
                "description": "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 revert-a-faulty-merge How-To[1] for more details."
            },
            {
                "flag": "",
                "long": "--no-edit",
                "arg": null,
                "description": "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 git-commit(1) for more details. In particular, if the <mode> is given a value of scissors, scissors will be appended to MERGEMSG before being passed on in the case of a conflict."
            },
            {
                "flag": "-n",
                "long": "--no-commit",
                "arg": null,
                "description": "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."
            },
            {
                "flag": "-s",
                "long": "--signoff",
                "arg": null,
                "description": "Add a Signed-off-by trailer at the end of the commit message. See the signoff option in git-commit(1) for more information. --strategy=<strategy> Use the given merge strategy. Should only be used once. See the MERGE STRATEGIES section in git-merge(1) for details. -X<option>, --strategy-option=<option> Pass the merge strategy-specific option through to the merge strategy. See git-merge(1) for details."
            },
            {
                "flag": "",
                "long": "--no-rerere-autoupdate",
                "arg": null,
                "description": "Allow the rerere mechanism to update the index with the result of auto-conflict resolution if possible."
            }
        ],
        "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."
        ],
        "see_also": [
            {
                "name": "git-cherry-pick",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-cherry-pick/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 6,
                "subsections": [
                    {
                        "name": "-e, --edit",
                        "lines": 19,
                        "flag": "-e",
                        "long": "--edit"
                    },
                    {
                        "name": "--no-edit",
                        "lines": 10,
                        "long": "--no-edit"
                    },
                    {
                        "name": "-n, --no-commit",
                        "lines": 17,
                        "flag": "-n",
                        "long": "--no-commit"
                    },
                    {
                        "name": "-s, --signoff",
                        "lines": 11,
                        "flag": "-s",
                        "long": "--signoff"
                    },
                    {
                        "name": "--rerere-autoupdate, --no-rerere-autoupdate",
                        "lines": 3,
                        "long": "--no-rerere-autoupdate"
                    }
                ]
            },
            {
                "name": "SEQUENCER SUBCOMMANDS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "--continue",
                        "lines": 4,
                        "long": "--continue"
                    },
                    {
                        "name": "--skip",
                        "lines": 2,
                        "long": "--skip"
                    },
                    {
                        "name": "--quit",
                        "lines": 3,
                        "long": "--quit"
                    },
                    {
                        "name": "--abort",
                        "lines": 2,
                        "long": "--abort"
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 4,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-revert - Revert some existing commits\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git revert [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...\ngit revert (--continue | --skip | --abort | --quit)\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Given one or more existing commits, revert the changes that the related\npatches introduce, and record some new commits that record them. This\nrequires your working tree to be clean (no modifications from the HEAD\ncommit).\n\nNote: git revert is used to record some new commits to reverse the\neffect of some earlier commits (often only a faulty one). If you want\nto throw away all uncommitted changes in your working directory, you\nshould see git-reset(1), particularly the --hard option. If you want to\nextract specific files as they were in another commit, you should see\ngit-restore(1), specifically the --source option. Take care with these\nalternatives as both will discard uncommitted changes in your working\ndirectory.\n\nSee \"Reset, restore and revert\" in git(1) for the differences between\nthe three commands.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "<commit>...\nCommits to revert. For a more complete list of ways to spell commit\nnames, see gitrevisions(7). Sets of commits can also be given but\nno traversal is done by default, see git-rev-list(1) and its\n--no-walk option.\n",
                "subsections": [
                    {
                        "name": "-e, --edit",
                        "content": "With this option, git revert will let you edit the commit message\nprior to committing the revert. This is the default if you run the\ncommand from a terminal.\n\n-m parent-number, --mainline parent-number\nUsually you cannot revert a merge because you do not know which\nside of the merge should be considered the mainline. This option\nspecifies the parent number (starting from 1) of the mainline and\nallows revert to reverse the change relative to the specified\nparent.\n\nReverting a merge commit declares that you will never want the tree\nchanges brought in by the merge. As a result, later merges will\nonly bring in tree changes introduced by commits that are not\nancestors of the previously reverted merge. This may or may not be\nwhat you want.\n\nSee the revert-a-faulty-merge How-To[1] for more details.\n",
                        "flag": "-e",
                        "long": "--edit"
                    },
                    {
                        "name": "--no-edit",
                        "content": "With this option, git revert will not start the commit message\neditor.\n\n--cleanup=<mode>\nThis option determines how the commit message will be cleaned up\nbefore being passed on to the commit machinery. See git-commit(1)\nfor more details. In particular, if the <mode> is given a value of\nscissors, scissors will be appended to MERGEMSG before being\npassed on in the case of a conflict.\n",
                        "long": "--no-edit"
                    },
                    {
                        "name": "-n, --no-commit",
                        "content": "Usually the command automatically creates some commits with commit\nlog messages stating which commits were reverted. This flag applies\nthe changes necessary to revert the named commits to your working\ntree and the index, but does not make the commits. In addition,\nwhen this option is used, your index does not have to match the\nHEAD commit. The revert is done against the beginning state of your\nindex.\n\nThis is useful when reverting more than one commits' effect to your\nindex in a row.\n\n-S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign\nGPG-sign commits. The keyid argument is optional and defaults to\nthe committer identity; if specified, it must be stuck to the\noption without a space.  --no-gpg-sign is useful to countermand\nboth commit.gpgSign configuration variable, and earlier --gpg-sign.\n",
                        "flag": "-n",
                        "long": "--no-commit"
                    },
                    {
                        "name": "-s, --signoff",
                        "content": "Add a Signed-off-by trailer at the end of the commit message. See\nthe signoff option in git-commit(1) for more information.\n\n--strategy=<strategy>\nUse the given merge strategy. Should only be used once. See the\nMERGE STRATEGIES section in git-merge(1) for details.\n\n-X<option>, --strategy-option=<option>\nPass the merge strategy-specific option through to the merge\nstrategy. See git-merge(1) for details.\n",
                        "flag": "-s",
                        "long": "--signoff"
                    },
                    {
                        "name": "--rerere-autoupdate, --no-rerere-autoupdate",
                        "content": "Allow the rerere mechanism to update the index with the result of\nauto-conflict resolution if possible.\n",
                        "long": "--no-rerere-autoupdate"
                    }
                ]
            },
            "SEQUENCER SUBCOMMANDS": {
                "content": "",
                "subsections": [
                    {
                        "name": "--continue",
                        "content": "Continue the operation in progress using the information in\n.git/sequencer. Can be used to continue after resolving conflicts\nin a failed cherry-pick or revert.\n",
                        "long": "--continue"
                    },
                    {
                        "name": "--skip",
                        "content": "Skip the current commit and continue with the rest of the sequence.\n",
                        "long": "--skip"
                    },
                    {
                        "name": "--quit",
                        "content": "Forget about the current operation in progress. Can be used to\nclear the sequencer state after a failed cherry-pick or revert.\n",
                        "long": "--quit"
                    },
                    {
                        "name": "--abort",
                        "content": "Cancel the operation and return to the pre-sequence state.\n",
                        "long": "--abort"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "git revert HEAD~3\nRevert the changes specified by the fourth last commit in HEAD and\ncreate a new commit with the reverted changes.\n\ngit revert -n master~5..master~2\nRevert the changes done by commits from the fifth last commit in\nmaster (included) to the third last commit in master (included),\nbut do not create any commit with the reverted changes. The revert\nonly modifies the working tree and the index.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "git-cherry-pick(1)\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n",
                "subsections": []
            },
            "NOTES": {
                "content": "1. revert-a-faulty-merge How-To\nfile:///usr/share/doc/git/html/howto/revert-a-faulty-merge.html\n\nGit 2.34.1                        02/26/2026                     GIT-REVERT(1)",
                "subsections": []
            }
        }
    }
}