🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 103 (from laksa078)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
15 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.5 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://blog.openreplay.com/undoing-local-and-remote-changes-with-git-revert/
Last Crawled2026-03-26 12:02:33 (15 days ago)
First Indexed2024-11-25 12:14:20 (1 year ago)
HTTP Status Code200
Meta TitleUndoing Local and Remote Changes with git revert
Meta DescriptionUse Git Revert to drop unwanted changes
Meta Canonicalnull
Boilerpipe Text
When developing, mistakes are around the corner, and you may need to undo a commit. Here is where the git revert command comes in! This article will teach you how to revert both local and remote commits. Discover how at OpenReplay.com . git revert is the command to revert some existing commits. To “revert” a commit means to record a new commit that undoes the changes introduced by one or more previous commits. (To delete a branch, follow our guide instead.) The syntax of the git revert command is as follows, where <commit-hash> is the hash of the commit you want to revert: git revert < commit-has h > Note : If you specify the hash of an old commit, git revert will only revert that specific commit, not the subsequent ones. When you perform a revert commit operation, Git automatically creates a new commit with the following name format: Revert "<original-commit-message>" This reverts commit "<commit-hash>" To prevent git revert from automatically committing the changes, use the -n or --no-commit option: git revert -n < commit-has h > How to Revert a Commit Let’s see how to use git revert to undo a commit, both locally and remotely. Revert a Local Commit The procedure to revert a local commit involves two steps: Use the git log command to identify the hash of the commit you want to revert: git log This returns a list of recent commits along with their commit hashes, as below: commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 (HEAD -> master) Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:56 2024 +0100 comments added commit 826a4cd9aee30602811b5970c9bff9e345aa26f3 Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:28 2024 +0100 'Hello, World!' logic added commit 184c11bd2d20c684ece47dc732c2ac65625868ca Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:04:16 2024 +0100 First commit Execute git revert to undo the changes of the chosen commit: git revert < commit-has h > Replace <commit-hash> with the hash of the commit you want to revert. For example: git revert 7c0663eba284fbaba9d238c86fa58370ec5fef04 Git will open the following file in your default text editor (in this case, Notepad++ ): If you close the text editor without making any changes, Git will create a commit using the default message format. The output will be: [master b853916] Revert "comments added" 1 file changed, 2 deletions(-) Verify that the revert commit was created with git log : commit b8539162ff05c1783a58a52219781cef60f1c31f (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:06:45 2024 +0100 Revert "comments added" This reverts commit 7c0663eba284fbaba9d238c86fa58370ec5fef04. commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... The first commit in the list is the one created by git revert . Otherwise, you can customize the revert commit message by editing the default message in the editor: Save the file, close the editor, and a revert commit with the custom message will be created: commit 8cfe847922f7290c0f03d51108ac2b692298fda2 (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:14:13 2024 +0100 "comments added" comment reverted commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... Note the commit message of the first commit—which is the revert commit—from git log . Uncover issues in your site Learn from your users, iterate faster and build something they really want. Explore our Github repo and show your support by starring us. Explore our Github repo and show your support by starring us. Revert a Remote Commit The procedure to revert a remote commit involves a few additional steps compared to reverting a local commit: Use git checkout to switch to the local branch corresponding to the remote branch you want to revert a commit on: git checkout < branch-nam e > Replace <branch-name> with the name of the local branch matching the remote branch. Utilize git fetch to verify that your local repository is up-to-date with the remote origin: git fetch origin If the remote branch is ahead of your local branch, pull the latest changes from the remote with git pull : git pull Run git log to identify the hash of the commit you want to revert to: git log Fire git revert to revert to the specified commit: git revert < commit-has h > Note : The procedure is the same as the one outlined in the previous chapter. Upload the changes to the remote repository with git push : git push FAQs What is the difference between the git revert and git reset commands? git revert creates a new commit that undoes one or more commits, preserving the commit history. git reset removes or modifies commits, altering the commit history. How do you specify the name of the commit created by git revert ? Perform a revert without automatically committing, and then commit it with git commit and a custom message: git revert -n < commit-has h > git commit -m "Custom message" Is it possible to revert multiple commits at once? Yes, by specifying a commit range as follows: git revert HEAD~5..HEAD For example, the above command will create a revert commit for each of the last 5 commits. How can git revert be prevented from opening the editor? With the --no-edit option: git revert --no-edit < commit-has h > Conclusion By following the procedures described in this article, you can revert commits on either a local or remote branch in your Git repository. Gain control over your UX See how users are using your site as if you were sitting next to them, learn and iterate faster with OpenReplay . — the open-source session replay tool for developers. Self-host it in minutes, and have complete control over your customer data. Check our GitHub repo and join the thousands of developers in our community.
Markdown
[![GitHub Repo stars](https://img.shields.io/github/stars/openreplay/openreplay)](https://github.com/openreplay/openreplay?utm_source=openreplay_blog&utm_content=github_stars) - Product - [Session Replay](https://openreplay.com/product/feature/session-replay?utm_source=openreplay_blog&utm_content=session_replay) - [DevTools](https://openreplay.com/product/feature/developer-tools?utm_source=openreplay_blog&utm_content=devtools) - [Product Analytics](https://openreplay.com/product/core/product-analytics?utm_source=openreplay_blog&utm_content=product_analytics) - [Co-Browsing](https://openreplay.com/product/feature/co-browsing?utm_source=openreplay_blog&utm_content=cobrowsing) - [Engineering](https://openreplay.com/solutions/teams/engineering/?utm_source=openreplay_blog&utm_content=engineering) - [Product Management](https://openreplay.com/solutions/teams/product-management/?utm_source=openreplay_blog&utm_content=product) - [Customer Support](https://openreplay.com/solutions/teams/customer-support/?utm_source=openreplay_blog&utm_content=customer_support) - [Research & Design](https://openreplay.com/solutions/teams/research-design/?utm_source=openreplay_blog&utm_content=design) - [Pricing](https://openreplay.com/pricing?utm_source=openreplay_blog&utm_content=pricing) - [Docs](https://docs.openreplay.com/en/home/?utm_source=openreplay_blog&utm_content=docs) - [![GitHub Repo stars](https://img.shields.io/github/stars/openreplay/openreplay)](https://github.com/openreplay/openreplay?utm_source=openreplay_blog&utm_content=github_stars) - [Self-Host](https://openreplay.com/pricing/#self-host) - [Try Cloud Free](https://openreplay.com/pricing?utm_source=openreplay_blog&utm_content=try_cloud_button) - [Self-Host](https://openreplay.com/pricing/#self-host) [Try Cloud](https://openreplay.com/pricing?utm_source=openreplay_blog&utm_content=try_cloud_button) - [Product]() - [Session Replay](https://openreplay.com/product/feature/session-replay?utm_source=openreplay_blog&utm_content=session_replay) - [DevTools](https://openreplay.com/product/feature/developer-tools?utm_source=openreplay_blog&utm_content=devtools) - [Product Analytics](https://openreplay.com/product/core/product-analytics?utm_source=openreplay_blog&utm_content=product_analytics) - [Co-Browsing](https://openreplay.com/product/feature/co-browsing?utm_source=openreplay_blog&utm_content=cobrowsing) - [Solutions]() - [Engineering](https://openreplay.com/solutions/teams/engineering/?utm_source=openreplay_blog&utm_content=engineering) - [Product Management](https://openreplay.com/solutions/teams/product-management/?utm_source=openreplay_blog&utm_content=product) - [Customer Support](https://openreplay.com/solutions/teams/customer-support/?utm_source=openreplay_blog&utm_content=customer_support) - [Research & Design](https://openreplay.com/solutions/teams/research-design/?utm_source=openreplay_blog&utm_content=design) - [Pricing](https://openreplay.com/pricing?utm_source=openreplay_blog&utm_content=pricing) - [Docs](https://docs.openreplay.com/en/home/?utm_source=openreplay_blog&utm_content=docs) [Back](https://blog.openreplay.com/) # Undoing Local and Remote Changes with git revert ![Antonello Zanini](https://blog.openreplay.com/authors/avatars/antonello-zanini.png) [Antonello Zanini](https://blog.openreplay.com/authors/antonello-zanini) Nov 25, 2024 · 4 min read ![Undoing Local and Remote Changes with git revert](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/hero.png) > When developing, mistakes are around the corner, and you may need to undo a commit. Here is where the [`git revert`](https://git-scm.com/docs/git-revert.html) command comes in! This article will teach you how to revert both local and remote commits. ![OpenReplay](https://blog.openreplay.com/media/replay-thumbnail-basics.svg) Craft the best digital experience Follow your intuitions and validate them with OpenReplay. Discover how at OpenReplay.com. [`git revert`](https://blog.openreplay.com/top-dozen-advanced-git-commands-to-know/#git-revert) is the command to revert some existing commits. To “revert” a commit means to record a new commit that undoes the changes introduced by one or more previous commits. (To delete a branch, [follow our guide](https://blog.openreplay.com/short--how-to-delete-a-local-git-branch/) instead.) The syntax of the `git revert` command is as follows, where `<commit-hash>` is the hash of the commit you want to revert: ``` git revert <commit-hash> ``` **Note**: If you specify the hash of an old commit, `git revert` will only revert that specific commit, not the subsequent ones. When you perform a revert commit operation, Git automatically creates a new commit with the following name format: ``` Revert "<original-commit-message>" This reverts commit "<commit-hash>" ``` ![The git revert commit in SourceTree](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/c2VmDlV.png) To prevent `git revert` from automatically committing the changes, use the [`-n` or `--no-commit`](https://git-scm.com/docs/git-revert.html#Documentation/git-revert.txt--n) option: ``` git revert -n <commit-hash> ``` ## How to Revert a Commit Let’s see how to use `git revert` to undo a commit, both locally and remotely. ### Revert a Local Commit The procedure to revert a local commit involves two steps: 1. Use the [`git log`](https://git-scm.com/docs/git-log) command to identify the hash of the commit you want to revert: ``` git log ``` This returns a list of recent commits along with their commit hashes, as below: ``` commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 (HEAD -> master) Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:56 2024 +0100 comments added commit 826a4cd9aee30602811b5970c9bff9e345aa26f3 Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:28 2024 +0100 'Hello, World!' logic added commit 184c11bd2d20c684ece47dc732c2ac65625868ca Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:04:16 2024 +0100 First commit ``` 1. Execute `git revert` to undo the changes of the chosen commit: ``` git revert <commit-hash> ``` Replace `<commit-hash>` with the hash of the commit you want to revert. For example: ``` git revert 7c0663eba284fbaba9d238c86fa58370ec5fef04 ``` Git will open the following file in your default text editor (in this case, [Notepad++](https://notepad-plus-plus.org/)): ![](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/Qbpw3TZ.png) If you close the text editor without making any changes, Git will create a commit using the default message format. The output will be: ``` [master b853916] Revert "comments added" 1 file changed, 2 deletions(-) ``` Verify that the revert commit was created with `git log`: ``` commit b8539162ff05c1783a58a52219781cef60f1c31f (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:06:45 2024 +0100 Revert "comments added" This reverts commit 7c0663eba284fbaba9d238c86fa58370ec5fef04. commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... ``` The first commit in the list is the one created by `git revert`. Otherwise, you can customize the revert commit message by editing the default message in the editor: ![](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/cvavpc1.png) Save the file, close the editor, and a revert commit with the custom message will be created: ``` commit 8cfe847922f7290c0f03d51108ac2b692298fda2 (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:14:13 2024 +0100 "comments added" comment reverted commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... ``` Note the commit message of the first commit—which is the revert commit—from `git log`. > ### Uncover issues in your site > Learn from your users, iterate faster and build something they really want. Explore our Github repo and show your support by starring us. Explore our [Github repo](https://github.com/openreplay/openreplay) and show your support by starring us. ### Revert a Remote Commit The procedure to revert a remote commit involves a few additional steps compared to reverting a local commit: 1. Use [`git checkout`](https://git-scm.com/docs/git-checkout) to switch to the local branch corresponding to the remote branch you want to revert a commit on: ``` git checkout <branch-name> ``` Replace `<branch-name>` with the name of the local branch matching the remote branch. 1. Utilize [`git fetch`](https://git-scm.com/docs/git-fetch) to verify that your local repository is up-to-date with the remote origin: ``` git fetch origin ``` 1. If the remote branch is ahead of your local branch, pull the latest changes from the remote with [`git pull`](https://git-scm.com/docs/git-pull): ``` git pull ``` 1. Run `git log` to identify the hash of the commit you want to revert to: ``` git log ``` 1. Fire `git revert` to revert to the specified commit: ``` git revert <commit-hash> ``` **Note**: The procedure is the same as the one outlined in the previous chapter. 1. Upload the changes to the remote repository with [`git push`](https://git-scm.com/docs/git-push): ``` git push ``` ## FAQs ### What is the difference between the `git revert` and `git reset` commands? `git revert` creates a new commit that undoes one or more commits, preserving the commit history. [`git reset`](https://git-scm.com/docs/git-reset) removes or modifies commits, altering the commit history. ### How do you specify the name of the commit created by `git revert`? Perform a revert without automatically committing, and then commit it with [`git commit`](https://git-scm.com/docs/git-commit) and a custom message: ``` git revert -n <commit-hash> git commit -m "Custom message" ``` ### Is it possible to revert multiple commits at once? Yes, by specifying a commit range as follows: ``` git revert HEAD~5..HEAD ``` For example, the above command will create a revert commit for each of the last 5 commits. ### How can `git revert` be prevented from opening the editor? With the [`--no-edit`](https://git-scm.com/docs/git-revert.html#Documentation/git-revert.txt---no-edit) option: ``` git revert --no-edit <commit-hash> ``` ## Conclusion By following the procedures described in this article, you can revert commits on either a local or remote branch in your Git repository. ### Gain control over your UX See how users are using your site as if you were sitting next to them, learn and iterate faster with [OpenReplay](https://openreplay.com/). — the open-source session replay tool for developers. Self-host it in minutes, and have complete control over your customer data. Check our [GitHub repo](https://github.com/openreplay/openreplay) and join the thousands of developers in our community. [![OpenReplay](https://blog.openreplay.com/media/openreplay-git-hero.svg)](https://github.com/openreplay/openreplay) ### More articles from OpenReplay Blog Star us on GitHub ![GitHub Repo stars](https://img.shields.io/github/stars/openreplay/openreplay) OpenReplay is a session replay and analytics tool, built for developers and self-hosted for full control over your data. ![SOC 2 Type 2](https://blog.openreplay.com/images/soc-badge.svg) SOC 2 Type II Compliant © 2025 OpenReplay is a registered trademark of Asayer, Inc. ###### Product [What's New](https://openreplay.com/releases?utm_source=openreplay_blog&utm_content=what_is_new) [Pricing](https://openreplay.com/pricing?utm_source=openreplay_blog&utm_content=pricing) [Integrations](https://openreplay.com/platform/integrations-api/?utm_source=openreplay_blog&utm_content=integrations) ###### Deploy [AWS](https://docs.openreplay.com/deployment/deploy-aws) [Azure](https://docs.openreplay.com/deployment/deploy-azure) [Google Cloud](https://docs.openreplay.com/deployment/deploy-gcp) [Kubernetes](https://docs.openreplay.com/deployment/deploy-kubernetes) ###### Resources [Docs](https://docs.openreplay.com/?utm_source=openreplay_blog&utm_content=docs) [Blog](https://blog.openreplay.com/?utm_source=openreplay_blog&utm_content=blog) [Session Replay Guide](https://openreplay.com/resources/session-replay-guide?utm_source=openreplay_blog) ###### Compare [Compare vs Fullstory](https://openreplay.com/compare/openreplay-vs-fullstory?utm_source=openreplay_blog&utm_content=compare_vs_fullstory) [Compare vs LogRocket](https://openreplay.com/compare/openreplay-vs-logrocket?utm_source=openreplay_blog&utm_content=compare_vs_logrocket) [Compare vs PostHog](https://openreplay.com/compare/openreplay-vs-posthog?utm_source=openreplay_blog&utm_content=compare_vs_posthog) [Compare vs Hotjar](https://openreplay.com/compare/openreplay-vs-hotjar?utm_source=openreplay_blog&utm_content=compare_vs_hotjar) ###### Contact [Sales](mailto:sales@openreplay.com) [Terms](https://openreplay.com/legal/terms) [Privacy](https://openreplay.com/legal/privacy) ###### Connect OpenReplay relies on [cookies](https://openreplay.com/legal/privacy) to make its website easier to use. I Accept
Readable Markdown
> When developing, mistakes are around the corner, and you may need to undo a commit. Here is where the [`git revert`](https://git-scm.com/docs/git-revert.html) command comes in! This article will teach you how to revert both local and remote commits. ![OpenReplay](https://blog.openreplay.com/media/replay-thumbnail-basics.svg) Discover how at OpenReplay.com. [`git revert`](https://blog.openreplay.com/top-dozen-advanced-git-commands-to-know/#git-revert) is the command to revert some existing commits. To “revert” a commit means to record a new commit that undoes the changes introduced by one or more previous commits. (To delete a branch, [follow our guide](https://blog.openreplay.com/short--how-to-delete-a-local-git-branch/) instead.) The syntax of the `git revert` command is as follows, where `<commit-hash>` is the hash of the commit you want to revert: ``` git revert <commit-hash> ``` **Note**: If you specify the hash of an old commit, `git revert` will only revert that specific commit, not the subsequent ones. When you perform a revert commit operation, Git automatically creates a new commit with the following name format: ``` Revert "<original-commit-message>" This reverts commit "<commit-hash>" ``` ![The git revert commit in SourceTree](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/c2VmDlV.png) To prevent `git revert` from automatically committing the changes, use the [`-n` or `--no-commit`](https://git-scm.com/docs/git-revert.html#Documentation/git-revert.txt--n) option: ``` git revert -n <commit-hash> ``` ## How to Revert a Commit Let’s see how to use `git revert` to undo a commit, both locally and remotely. ### Revert a Local Commit The procedure to revert a local commit involves two steps: 1. Use the [`git log`](https://git-scm.com/docs/git-log) command to identify the hash of the commit you want to revert: ``` git log ``` This returns a list of recent commits along with their commit hashes, as below: ``` commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 (HEAD -> master) Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:56 2024 +0100 comments added commit 826a4cd9aee30602811b5970c9bff9e345aa26f3 Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:05:28 2024 +0100 'Hello, World!' logic added commit 184c11bd2d20c684ece47dc732c2ac65625868ca Author: Antonello Zanini antonello@writech.run Date: Fri Nov 15 12:04:16 2024 +0100 First commit ``` 1. Execute `git revert` to undo the changes of the chosen commit: ``` git revert <commit-hash> ``` Replace `<commit-hash>` with the hash of the commit you want to revert. For example: ``` git revert 7c0663eba284fbaba9d238c86fa58370ec5fef04 ``` Git will open the following file in your default text editor (in this case, [Notepad++](https://notepad-plus-plus.org/)): ![](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/Qbpw3TZ.png) If you close the text editor without making any changes, Git will create a commit using the default message format. The output will be: ``` [master b853916] Revert "comments added" 1 file changed, 2 deletions(-) ``` Verify that the revert commit was created with `git log`: ``` commit b8539162ff05c1783a58a52219781cef60f1c31f (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:06:45 2024 +0100 Revert "comments added" This reverts commit 7c0663eba284fbaba9d238c86fa58370ec5fef04. commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... ``` The first commit in the list is the one created by `git revert`. Otherwise, you can customize the revert commit message by editing the default message in the editor: ![](https://blog.openreplay.com/images/undoing-local-and-remote-changes-with-git-revert/images/cvavpc1.png) Save the file, close the editor, and a revert commit with the custom message will be created: ``` commit 8cfe847922f7290c0f03d51108ac2b692298fda2 (HEAD -> master) Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:14:13 2024 +0100 "comments added" comment reverted commit 7c0663eba284fbaba9d238c86fa58370ec5fef04 Author: Antonello Zanini <antonello@writech.run> Date: Fri Nov 15 12:05:56 2024 +0100 comments added # omitted for brevity... ``` Note the commit message of the first commit—which is the revert commit—from `git log`. > ### Uncover issues in your site > Learn from your users, iterate faster and build something they really want. Explore our Github repo and show your support by starring us. Explore our [Github repo](https://github.com/openreplay/openreplay) and show your support by starring us. ### Revert a Remote Commit The procedure to revert a remote commit involves a few additional steps compared to reverting a local commit: 1. Use [`git checkout`](https://git-scm.com/docs/git-checkout) to switch to the local branch corresponding to the remote branch you want to revert a commit on: ``` git checkout <branch-name> ``` Replace `<branch-name>` with the name of the local branch matching the remote branch. 1. Utilize [`git fetch`](https://git-scm.com/docs/git-fetch) to verify that your local repository is up-to-date with the remote origin: ``` git fetch origin ``` 1. If the remote branch is ahead of your local branch, pull the latest changes from the remote with [`git pull`](https://git-scm.com/docs/git-pull): ``` git pull ``` 1. Run `git log` to identify the hash of the commit you want to revert to: ``` git log ``` 1. Fire `git revert` to revert to the specified commit: ``` git revert <commit-hash> ``` **Note**: The procedure is the same as the one outlined in the previous chapter. 1. Upload the changes to the remote repository with [`git push`](https://git-scm.com/docs/git-push): ``` git push ``` ## FAQs ### What is the difference between the `git revert` and `git reset` commands? `git revert` creates a new commit that undoes one or more commits, preserving the commit history. [`git reset`](https://git-scm.com/docs/git-reset) removes or modifies commits, altering the commit history. ### How do you specify the name of the commit created by `git revert`? Perform a revert without automatically committing, and then commit it with [`git commit`](https://git-scm.com/docs/git-commit) and a custom message: ``` git revert -n <commit-hash> git commit -m "Custom message" ``` ### Is it possible to revert multiple commits at once? Yes, by specifying a commit range as follows: ``` git revert HEAD~5..HEAD ``` For example, the above command will create a revert commit for each of the last 5 commits. ### How can `git revert` be prevented from opening the editor? With the [`--no-edit`](https://git-scm.com/docs/git-revert.html#Documentation/git-revert.txt---no-edit) option: ``` git revert --no-edit <commit-hash> ``` ## Conclusion By following the procedures described in this article, you can revert commits on either a local or remote branch in your Git repository. ### Gain control over your UX See how users are using your site as if you were sitting next to them, learn and iterate faster with [OpenReplay](https://openreplay.com/). — the open-source session replay tool for developers. Self-host it in minutes, and have complete control over your customer data. Check our [GitHub repo](https://github.com/openreplay/openreplay) and join the thousands of developers in our community. [![OpenReplay](https://blog.openreplay.com/media/openreplay-git-hero.svg)](https://github.com/openreplay/openreplay)
Shard103 (laksa)
Root Hash1248022234581704903
Unparsed URLcom,openreplay!blog,/undoing-local-and-remote-changes-with-git-revert/ s443