ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.9 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://docs.gitlab.com/user/project/merge_requests/revert_changes/ |
| Last Crawled | 2026-03-15 06:50:46 (27 days ago) |
| First Indexed | 2025-03-01 14:34:22 (1 year ago) |
| HTTP Status Code | 200 |
| Meta Title | Revert changes | GitLab Docs |
| Meta Description | How to revert commits or merge requests in a GitLab project. |
| Meta Canonical | null |
| Boilerpipe Text | Tier
: Free, Premium, Ultimate
Offering
: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Mistakes happen in code. Version control makes it possible to fix those mistakes by reverting them.
When you revert a commit, you create a new commit (a revert commit) that reverses the
bad change, rather than erasing the existence of the problem from your project’s history. Revert commits
provide a clear audit trail, rather than a gap where the previous commit was. The revert commit
follows your project’s access controls and processes, and:
Removes the lines added in the original commit.
Restores the lines removed in the original commit.
Restores the lines modified in the original commit to their previous state.
Reverts are not limited to just commits. If the bad change spans more than one commit, consider
reverting all changes from the merge request, rather than reverting commit by commit. This approach
provides a cleaner audit trail.
Revert a merge request
After a merge request merges, you can revert all changes in the merge request.
Prerequisites:
You must have a role for the project that allows you to edit merge requests, and add
code to the repository.
Your project must use the
merge method
Merge Commit
,
set in your project’s
Settings
>
Merge requests
.
In GitLab 16.9 and later
, you can revert
fast-forwarded commits from the GitLab UI if either:
The commits are squashed, or
The merge request contains a single commit.
To revert merge request
Example
:
On the top bar, select
Search or go to
and find your project.
In the left sidebar, select
Code
>
Merge requests
.
From the secondary menu, select
Merged
, and select your merge request (here,
Example
).
Scroll to the merge request reports area, and find the report showing the
Merged by
information.
Select
Revert
.
In
Revert in branch
, select the branch to revert your changes into.
To revert immediately, without a merge request:
Clear
Start a new merge request
.
Select
Revert
, and the revert of
Example
is complete.
To review the revert in a new merge request instead of reverting immediately,
select
Start a new merge request
, then:
Fill in the fields for your revert merge request, then select
Create merge request
.
When the merge request merges, the revert of
Example
is complete.
Revert a commit
You can revert any commit in a repository into either:
The current branch.
A new merge request.
Prerequisites:
Your role for the project must allow you to edit merge requests, and add
code to the repository.
The commit must not have already been reverted, as the
Revert
option is not
shown in this case.
To do this:
On the top bar, select
Search or go to
and find your project.
If you know the merge request that contains the commit:
In the left sidebar, select
Code
>
Merge requests
, then select your merge request.
Select
Commits
, then select the title of the commit you want to revert.
This displays the commit in the context of your merge request.
Below the secondary menu, GitLab shows the message
Viewing commit
00001111
,
where
00001111
is the hash of the commit. Select the commit hash to show
the commit’s page.
If you don’t know the merge request the commit originated from:
In the left sidebar, select
Code
>
Commits
.
Select the title of the commit to display full information about the commit.
In the upper-right corner, select
Options
, then select
Revert
.
In
Revert in branch
, select the branch to revert your changes into.
To revert immediately, without a merge request:
Clear
Start a new merge request
.
Select
Revert
.
To review the revert in a new merge request instead of reverting immediately,
select
Start a new merge request
, then:
Fill in the fields for your revert merge request, then select
Create merge request
.
When the merge request merges, the commit revert is complete.
Revert a merge commit to a different parent commit
When you revert a merge commit, the branch you merged to (often
main
) is always the
first parent. To revert a merge commit to a different parent, you must revert the commit from
the command line, see
Revert and undo changes with Git
.
Redact text from repository
For more information on
redacting text
from a repository and other techniques to remove data, see
repository size
.
Official
git revert
documentation
Undo changes by using Git
Revert a commit
with the Commits API
How changelogs
handle reverted commits |
| Markdown | [Skip to main content](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#skipTarget) [Go to GitLab Docs homepage](https://docs.gitlab.com/)
[What's new?](https://about.gitlab.com/releases/whats-new/)
English
- Language
- English
- 日本語
v18.10
- - [18\.10 (not yet released)](https://docs.gitlab.com/user/project/merge_requests/revert_changes/)
- - [18\.9 (recently released)](https://docs.gitlab.com/18.9/user/project/merge_requests/revert_changes/)
- [18\.8](https://docs.gitlab.com/18.8/user/project/merge_requests/revert_changes/)
- [18\.7](https://docs.gitlab.com/18.7/user/project/merge_requests/revert_changes/)
- - [17\.11](https://docs.gitlab.com/17.11/user/project/merge_requests/revert_changes/)
- [16\.11](https://docs.gitlab.com/16.11/ee/user/project/merge_requests/revert_changes.html)
- - [Archives](https://docs.gitlab.com/archives)
Select theme and layout
- Light mode
- Dark mode
- Auto
- Fixed width
- Fluid width
[What's new?](https://about.gitlab.com/releases/whats-new/) [Get free trial](https://gitlab.com/-/trial_registrations/new?glm_source=docs.gitlab.com&glm_content=navigation-cta-docs)
Toggle menu
- [Use GitLab](https://docs.gitlab.com/user/)
- [GitLab Duo](https://docs.gitlab.com/user/gitlab_duo/)
- [Extend](https://docs.gitlab.com/api/)
- [Install](https://docs.gitlab.com/install/)
- [Administer](https://docs.gitlab.com/administration/)
- [Subscribe](https://docs.gitlab.com/subscriptions/)
- [Contribute](https://docs.gitlab.com/development/)
- [Solutions](https://docs.gitlab.com/solutions/)
Select a topic
[Getting started](https://docs.gitlab.com/user/get_started/)
[Tutorials](https://docs.gitlab.com/tutorials/)
[Manage your organization](https://docs.gitlab.com/topics/set_up_organization/)
[Organize work with projects](https://docs.gitlab.com/user/project/organize_work_with_projects/)
[Plan and track work](https://docs.gitlab.com/topics/plan_and_track/)
[Manage authentication and authorization](https://docs.gitlab.com/auth/)
[Use Git](https://docs.gitlab.com/topics/git/)
[Manage your code](https://docs.gitlab.com/topics/manage_code/)
[Getting started](https://docs.gitlab.com/user/get_started/get_started_managing_code/)
[Repositories](https://docs.gitlab.com/user/project/repository/)
[Merge requests](https://docs.gitlab.com/user/project/merge_requests/)
[Commits](https://docs.gitlab.com/user/project/merge_requests/commits/)
[Changes](https://docs.gitlab.com/user/project/merge_requests/changes/)
[Create merge requests](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/)
[Reviewing and managing merge requests](https://docs.gitlab.com/user/project/merge_requests/reviews/)
[Workflows](https://docs.gitlab.com/user/project/merge_requests/authorization_for_merge_requests/)
[Merge methods](https://docs.gitlab.com/user/project/merge_requests/methods/)
[Auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
[Title validation](https://docs.gitlab.com/user/project/merge_requests/title_validation/)
[Collaborate across forks](https://docs.gitlab.com/user/project/merge_requests/allow_collaboration/)
[Merge conflicts](https://docs.gitlab.com/user/project/merge_requests/conflicts/)
[Cherry-pick changes](https://docs.gitlab.com/user/project/merge_requests/cherry_pick_changes/)
[Reverting changes](https://docs.gitlab.com/user/project/merge_requests/revert_changes/)
[Stacked diffs](https://docs.gitlab.com/user/project/merge_requests/stacked_diffs/)
[Export merge requests to CSV](https://docs.gitlab.com/user/project/merge_requests/csv_export/)
[Troubleshooting](https://docs.gitlab.com/user/project/merge_requests/merge_request_troubleshooting/)
[Remote development](https://docs.gitlab.com/user/project/remote_development/)
[Use CI/CD to build your application](https://docs.gitlab.com/topics/build_your_application/)
[Secure your application](https://docs.gitlab.com/user/application_security/secure_your_application/)
[Deploy and release your application](https://docs.gitlab.com/topics/release_your_application/)
[Manage your infrastructure](https://docs.gitlab.com/user/infrastructure/)
[Monitor your application](https://docs.gitlab.com/operations/)
[Analyze GitLab usage](https://docs.gitlab.com/user/analytics/)
[Feature support](https://docs.gitlab.com/policy/development_stages_support/)
[Find your GitLab version](https://docs.gitlab.com/user/version/)
/
1. [GitLab Docs](https://docs.gitlab.com/)
2. [Use GitLab](https://docs.gitlab.com/user/)
3. [Manage your code](https://docs.gitlab.com/topics/manage_code/)
4. [Merge requests](https://docs.gitlab.com/user/project/merge_requests/)
5. [Workflows](https://docs.gitlab.com/user/project/merge_requests/authorization_for_merge_requests/)
6. [Reverting changes](https://docs.gitlab.com/user/project/merge_requests/revert_changes/)
***
# Revert changes
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Mistakes happen in code. Version control makes it possible to fix those mistakes by reverting them.
When you revert a commit, you create a new commit (a revert commit) that reverses the bad change, rather than erasing the existence of the problem from your project’s history. Revert commits provide a clear audit trail, rather than a gap where the previous commit was. The revert commit follows your project’s access controls and processes, and:
- Removes the lines added in the original commit.
- Restores the lines removed in the original commit.
- Restores the lines modified in the original commit to their previous state.
Reverts are not limited to just commits. If the bad change spans more than one commit, consider reverting all changes from the merge request, rather than reverting commit by commit. This approach provides a cleaner audit trail.
## Revert a merge request
After a merge request merges, you can revert all changes in the merge request.
Prerequisites:
- You must have a role for the project that allows you to edit merge requests, and add code to the repository.
- Your project must use the [merge method](https://docs.gitlab.com/user/project/merge_requests/methods/#fast-forward-merge) **Merge Commit**, set in your project’s **Settings** \> **Merge requests**.
[In GitLab 16.9 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/22236), you can revert fast-forwarded commits from the GitLab UI if either:
- The commits are squashed, or
- The merge request contains a single commit.
To revert merge request `Example`:
1. On the top bar, select **Search or go to** and find your project.
2. In the left sidebar, select **Code** \> **Merge requests**.
3. From the secondary menu, select **Merged**, and select your merge request (here, `Example`).
4. Scroll to the merge request reports area, and find the report showing the **Merged by** information.
5. Select **Revert**.
6. In **Revert in branch**, select the branch to revert your changes into.
7. To revert immediately, without a merge request:
1. Clear **Start a new merge request**.
2. Select **Revert**, and the revert of `Example` is complete.
8. To review the revert in a new merge request instead of reverting immediately, select **Start a new merge request**, then:
1. Fill in the fields for your revert merge request, then select **Create merge request**.
2. When the merge request merges, the revert of `Example` is complete.
## Revert a commit
You can revert any commit in a repository into either:
- The current branch.
- A new merge request.
Prerequisites:
- Your role for the project must allow you to edit merge requests, and add code to the repository.
- The commit must not have already been reverted, as the **Revert** option is not shown in this case.
To do this:
1. On the top bar, select **Search or go to** and find your project.
2. If you know the merge request that contains the commit:
1. In the left sidebar, select **Code** \> **Merge requests**, then select your merge request.
2. Select **Commits**, then select the title of the commit you want to revert. This displays the commit in the context of your merge request.
3. Below the secondary menu, GitLab shows the message **Viewing commit `00001111`**, where `00001111` is the hash of the commit. Select the commit hash to show the commit’s page.
3. If you don’t know the merge request the commit originated from:
1. In the left sidebar, select **Code** \> **Commits**.
2. Select the title of the commit to display full information about the commit.
4. In the upper-right corner, select **Options**, then select **Revert**.
5. In **Revert in branch**, select the branch to revert your changes into.
6. To revert immediately, without a merge request:
1. Clear **Start a new merge request**.
2. Select **Revert**.
7. To review the revert in a new merge request instead of reverting immediately, select **Start a new merge request**, then:
1. Fill in the fields for your revert merge request, then select **Create merge request**.
2. When the merge request merges, the commit revert is complete.
### Revert a merge commit to a different parent commit
When you revert a merge commit, the branch you merged to (often `main`) is always the first parent. To revert a merge commit to a different parent, you must revert the commit from the command line, see [Revert and undo changes with Git](https://docs.gitlab.com/topics/git/undo/#revert-a-merge-commit-to-a-different-parent).
## Redact text from repository
For more information on [redacting text](https://docs.gitlab.com/user/project/repository/repository_size/#redact-text-from-repository) from a repository and other techniques to remove data, see [repository size](https://docs.gitlab.com/user/project/repository/repository_size/).
## Related topics
- [Official `git revert` documentation](https://git-scm.com/docs/git-revert)
- [Undo changes by using Git](https://docs.gitlab.com/topics/git/undo/)
- [Revert a commit](https://docs.gitlab.com/api/commits/#revert-a-commit) with the Commits API
- How changelogs [handle reverted commits](https://docs.gitlab.com/user/project/changelogs/#reverted-commit-handling)
Was this page helpful?
Yes
No
Edit this page
- - [Open in Web IDE`.`Quickly and easily edit multiple files.](https://gitlab.com/-/ide/project/gitlab-org/gitlab/edit/master/-/doc/user/project/merge_requests/revert_changes.md)
- [View page sourceEdit this file only.](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/project/merge_requests/revert_changes.md)
- [Create an issueSuggest improvements.](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Documentation)
- [Revert a merge request](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#revert-a-merge-request)
- [Revert a commit](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#revert-a-commit)
- [Revert a merge commit to a different parent commit](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#revert-a-merge-commit-to-a-different-parent-commit)
- [Redact text from repository](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#redact-text-from-repository)
- [Related topics](https://docs.gitlab.com/user/project/merge_requests/revert_changes/#related-topics)
[](https://docs.gitlab.com/)
- [Facebook](https://www.facebook.com/gitlab)
- [LinkedIn](https://www.linkedin.com/company/gitlab-com)
- [Twitter](https://twitter.com/gitlab)
- [YouTube](https://www.youtube.com/channel/UCnMGQ8QHMAnVIsI3xJrihhg)
[](https://creativecommons.org/licenses/by-sa/4.0/)
Company
- [About GitLab](https://about.gitlab.com/company/)
- [View pricing](https://about.gitlab.com/pricing/)
- [Try GitLab for free](https://about.gitlab.com/free-trial/)
Feedback
- [View page source](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/project/merge_requests/revert_changes.md)
- [Edit in Web IDE](https://gitlab.com/-/ide/project/gitlab-org/gitlab/edit/master/-/doc/user/project/merge_requests/revert_changes.md)
- [Contribute to GitLab](https://about.gitlab.com/community/contribute/)
- [Suggest updates](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Documentation)
Help & Community
- [Get certified](https://university.gitlab.com/pages/certifications)
- [Get support](https://about.gitlab.com/support/)
- [Post on the GitLab forum](https://forum.gitlab.com/new-topic?title=topic%20title&body=topic%20body&tags=docs-feedback)
Resources
- [Terms](https://about.gitlab.com/terms/)
- [Privacy statement](https://about.gitlab.com/privacy/)
- [Use of generative AI](https://docs.gitlab.com/legal/use_generative_ai/)
- [Acceptable use of user licenses](https://docs.gitlab.com/legal/licensing_policy/)
 |
| Readable Markdown | ***
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
Mistakes happen in code. Version control makes it possible to fix those mistakes by reverting them.
When you revert a commit, you create a new commit (a revert commit) that reverses the bad change, rather than erasing the existence of the problem from your project’s history. Revert commits provide a clear audit trail, rather than a gap where the previous commit was. The revert commit follows your project’s access controls and processes, and:
- Removes the lines added in the original commit.
- Restores the lines removed in the original commit.
- Restores the lines modified in the original commit to their previous state.
Reverts are not limited to just commits. If the bad change spans more than one commit, consider reverting all changes from the merge request, rather than reverting commit by commit. This approach provides a cleaner audit trail.
## Revert a merge request
After a merge request merges, you can revert all changes in the merge request.
Prerequisites:
- You must have a role for the project that allows you to edit merge requests, and add code to the repository.
- Your project must use the [merge method](https://docs.gitlab.com/user/project/merge_requests/methods/#fast-forward-merge) **Merge Commit**, set in your project’s **Settings** \> **Merge requests**.
[In GitLab 16.9 and later](https://gitlab.com/gitlab-org/gitlab/-/issues/22236), you can revert fast-forwarded commits from the GitLab UI if either:
- The commits are squashed, or
- The merge request contains a single commit.
To revert merge request `Example`:
1. On the top bar, select **Search or go to** and find your project.
2. In the left sidebar, select **Code** \> **Merge requests**.
3. From the secondary menu, select **Merged**, and select your merge request (here, `Example`).
4. Scroll to the merge request reports area, and find the report showing the **Merged by** information.
5. Select **Revert**.
6. In **Revert in branch**, select the branch to revert your changes into.
7. To revert immediately, without a merge request:
1. Clear **Start a new merge request**.
2. Select **Revert**, and the revert of `Example` is complete.
8. To review the revert in a new merge request instead of reverting immediately, select **Start a new merge request**, then:
1. Fill in the fields for your revert merge request, then select **Create merge request**.
2. When the merge request merges, the revert of `Example` is complete.
## Revert a commit
You can revert any commit in a repository into either:
- The current branch.
- A new merge request.
Prerequisites:
- Your role for the project must allow you to edit merge requests, and add code to the repository.
- The commit must not have already been reverted, as the **Revert** option is not shown in this case.
To do this:
1. On the top bar, select **Search or go to** and find your project.
2. If you know the merge request that contains the commit:
1. In the left sidebar, select **Code** \> **Merge requests**, then select your merge request.
2. Select **Commits**, then select the title of the commit you want to revert. This displays the commit in the context of your merge request.
3. Below the secondary menu, GitLab shows the message **Viewing commit `00001111`**, where `00001111` is the hash of the commit. Select the commit hash to show the commit’s page.
3. If you don’t know the merge request the commit originated from:
1. In the left sidebar, select **Code** \> **Commits**.
2. Select the title of the commit to display full information about the commit.
4. In the upper-right corner, select **Options**, then select **Revert**.
5. In **Revert in branch**, select the branch to revert your changes into.
6. To revert immediately, without a merge request:
1. Clear **Start a new merge request**.
2. Select **Revert**.
7. To review the revert in a new merge request instead of reverting immediately, select **Start a new merge request**, then:
1. Fill in the fields for your revert merge request, then select **Create merge request**.
2. When the merge request merges, the commit revert is complete.
### Revert a merge commit to a different parent commit
When you revert a merge commit, the branch you merged to (often `main`) is always the first parent. To revert a merge commit to a different parent, you must revert the commit from the command line, see [Revert and undo changes with Git](https://docs.gitlab.com/topics/git/undo/#revert-a-merge-commit-to-a-different-parent).
## Redact text from repository
For more information on [redacting text](https://docs.gitlab.com/user/project/repository/repository_size/#redact-text-from-repository) from a repository and other techniques to remove data, see [repository size](https://docs.gitlab.com/user/project/repository/repository_size/).
- [Official `git revert` documentation](https://git-scm.com/docs/git-revert)
- [Undo changes by using Git](https://docs.gitlab.com/topics/git/undo/)
- [Revert a commit](https://docs.gitlab.com/api/commits/#revert-a-commit) with the Commits API
- How changelogs [handle reverted commits](https://docs.gitlab.com/user/project/changelogs/#reverted-commit-handling) |
| Shard | 184 (laksa) |
| Root Hash | 17323278190169633584 |
| Unparsed URL | com,gitlab!docs,/user/project/merge_requests/revert_changes/ s443 |