> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/continuous-integration/3.0/use-harness-ci/use-harness-ci/codebase-configuration/git-revert-commit.md).

# git revert from a CI pipeline

Use a run step to revert git commit(s).

You might need to revert a pull request in a Git repository if the changes cause problems, introduce bugs, or become unnecessary. Harness CI supports native git revert using the [drone-git-revert-commit plugin](https://github.com/harness-community/drone-git-revert-commit), which simplifies the process compared to running manual git commands in a **Run** step.

### Using the git-revert-commit plugin <a href="#using-the-git-revert-commit-plugin" id="using-the-git-revert-commit-plugin"></a>

Here is an example of a **Plugin** step that reverts a git commit based on the commit SHA in the pipeline context:

```yaml
- step:
    type: Plugin
    name: Git Revert Commit
    identifier: git_revert_commit
    spec:
      connectorRef: YOUR_IMAGE_REGISTRY_CONNECTOR
      image: plugins/git-revert-commit:linux-amd64
      settings:
        git_pat: <+secrets.getValue("YOUR_GIT_PAT_SECRET")>
        commit_sha: <+codebase.commitSha>
        create_revert_branch: "true"
```

{% hint style="info" %}
The plugin requires a Git Personal Access Token (PAT) with read/write permissions to the repository.
{% endhint %}

For more configuration options, see the [plugin README](https://github.com/harness-community/drone-git-revert-commit/blob/main/README.md).

[This guide](/continuous-integration/3.0/troubleshooting-and-resources/tutorials-and-code-samples/security/git-revert-from-pr.md) shows how to use a similar script to revert a commit from a PR based on security scan results.

{% @harness-feedback/feedback %}
