🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 95 (from laksa094)

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
3 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.1 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://www.jetbrains.com/help/idea/undo-changes.html
Last Crawled2026-04-14 11:48:52 (3 days ago)
First Indexed2017-12-03 05:04:31 (8 years ago)
HTTP Status Code200
Meta TitleUndo changes in Git repository | IntelliJ IDEA Documentation
Meta DescriptionLearn how to undo changes in your git repository by using IntelliJ IDEA either before or after committing them.
Meta Canonicalnull
Boilerpipe Text
Last modified: 06 November 2025 Revert uncommitted changes  You can always undo the changes you've made locally before you commit them: In the Commit tool window ( Alt 0 0 ) , select one or more files that you want to revert, and select Rollback from the context menu, or press Ctrl Alt 0 Z . In the dialog that opens, check the list of files to be reverted. Select the Delete local copies of added files checkbox to revert added files as well as your changes in modified ones. All changes made to the selected files since the last commit will be discarded, and they will disappear from the active changelist. Unstage files  By default, IntelliJ IDEA uses the changelists concept where modified files are staged automatically. If a file is already under version control, and you do not want to commit it, you can: Remove it from the commit : do not select it in the Changes area of the Commit tool window. Move it to another changelist . If you are more used to the staging concept, select the Enable staging area option in the Version Control | Git settings page  Ctrl Alt 0 S . Also, by default IntelliJ IDEA suggests adding each newly created file under version control. You can change this behavior in Settings | Version Control | Confirmation using When files are created and When files are deleted settings respectively. Undo the last commit  IntelliJ IDEA allows you to undo the last commit in the current branch. note You cannot undo a commit if it was pushed to a protected branch, that is a branch to which force --push is not allowed (configure protected branches in the Version Control | Git settings page  Ctrl Alt 0 S ) Note that if a branch is marked as protected on GitHub, IntelliJ IDEA will automatically mark it as protected when you check it out. Open the Git tool window Alt 0 9 and switch to the Log tab. Select the last commit in the current branch and choose Undo Commit from the context menu. In the dialog that opens, select a changelist where the changes you are going to discard will be moved. You can either select an existing changelist from the Name list, or specify the name of a new changelist (the commit message is used by default). Type an optional comment. When the new changelist is submitted to the repository, this comment will appear in the Comment text area of the Commit Changes dialog. Select the Set active option if you want to make the changelist with the changes you are about to discard the active changelist. Select the Track context option if you want IntelliJ IDEA to remember your context and reload currently opened files in the editor when this changelist becomes active. Revert a pushed commit  If you notice an error in a specific commit that has already been pushed, you can revert that commit. This operation results in a new commit that reverses the effect of the commit you want to undo. Thus, the project history is preserved, as the original commit remains intact. Locate the commit you want to revert in the Log tab of the Git tool window Alt 0 9 , right-click it and select Revert Commit from the context menu. This option is also available from the context menu of a commit in the file History view. The Commit Changes dialog will open with an automatically generated commit message. note If you apply this action to multiple commits selected in the Log view, a separate commit will be created to revert each of them. If the selected commit contains several files, and you only need to revert some of them, deselect the files you do not want to touch. Click Commit to commit a changeset that reverts the changes to the selected files in this particular commit. Revert selected changes  IntelliJ IDEA lets you undo selected changes from a pushed commit if this commit contains multiple files and you only need to revert some of them. In the Log view select the commit containing the changes you want to discard. In the Changed Files pane, right-click the file that you want to revert and select Revert Selected Changes from the context menu. This results in a new commit that reverses the changes you want to undo. Drop a commit  Unlike reverting a commit , which is reflected in the branch history, you can discard a pushed commit in the current branch without leaving any traces of the operation. warning Like any operation that rewrites a branch history, dropping a commit requires using force push and cannot be performed in protected branches (these can be configured in the Version Control | Git settings page  Ctrl Alt 0 S ). Select a commit you want to discard in the Log view and choose Drop Commit from the context menu. Drop selected changes from a commit  If you have committed changes in several files and now want to roll back some of these changes before pushing your commit, instead of dropping an entire commit , you can drop only some of these changes. Note that the dropped changes will be deleted. In the Log tab of the Git tool window Alt 0 9 , select the local branch and then the commit with the changes you want to drop. In the Changed Files pane on the right, select the files with the changes you want to drop, right-click them, and select Drop Selected Changes . tip If the commit was already pushed, it is still possible to drop the selected changes. However, you will have to either use force push (cannot be performed in protected branches) or update your project first to sync the local branch with the remote tracked branch and then push the merge commit. Reset a branch to a specific commit  If you notice an error in a set of recent commits and want to redo that part, you can roll back your repository to a specific state. This is done by resetting the current branch HEAD to a specified commit (and optionally resetting the index and working tree if you prefer not to reflect the undo in the history). Open the Version Control tool window Alt 0 9 and switch to the Log tab. Select the commit that you want to move HEAD onto and select Reset Current Branch to Here from the context menu. In the Git Reset dialog that opens, select how you want your working tree and the index to be updated and click Reset : Soft : all changes from commits that were made after the selected commit will be staged (that means they will be moved to the Commit window so that you can review them and commit later if necessary). Mixed : changes made after the selected commit will be preserved but will not be staged for commit. Hard : all changes made after the selected commit will be discarded (both staged and committed). Keep : committed changes made after the selected commit will be discarded, but local changes will be kept intact. Get a previous revision of a file  If you need to revert a single file instead of discarding a whole commit that includes changes to several files, you can return to a particular version of that file: Select the necessary file in any view (the Project tool window ( Alt 0 1 ) , the editor, the Commit window, and so on). Select Git | Selected File | Show History from the main menu or Git | Show History from the context menu of the selection. The History tab is added to the Git tool window showing the history for the selected file and allowing you to review and compare its revisions. When you've identified the revision you want to roll back to, select it in the list and choose Get from the context menu.
Markdown
IntelliJ IDEA 2026\.1 Shortcuts: Windows [Get IntelliJ IDEA](https://www.jetbrains.com/idea/download/) [ConferenceJoin 2,000+ devs and Kotlin enthusiasts at KotlinConf, Munich, May 2026](https://jb.gg/parm9c) - [New in IntelliJ IDEA 2026.1](https://www.jetbrains.com/help/idea/new-in-this-release.html) - [Getting started](https://www.jetbrains.com/help/idea/getting-started.html) - [IDE configuration](https://www.jetbrains.com/help/idea/configuring-project-and-ide-settings.html) - [Project configuration](https://www.jetbrains.com/help/idea/working-with-projects.html) - [Search everywhere](https://www.jetbrains.com/help/idea/searching-everywhere.html) - [Write and edit source code](https://www.jetbrains.com/help/idea/working-with-source-code.html) - [Compilation and building](https://www.jetbrains.com/help/idea/compiling-applications.html) - [Running](https://www.jetbrains.com/help/idea/running-applications.html) - [Debugging](https://www.jetbrains.com/help/idea/debugging-code.html) - [Deployment](https://www.jetbrains.com/help/idea/deploying-applications.html) - [Testing](https://www.jetbrains.com/help/idea/tests-in-ide.html) - [Analysis](https://www.jetbrains.com/help/idea/analysis.html) - [Version control](https://www.jetbrains.com/help/idea/version-control-integration.html) - [Git](https://www.jetbrains.com/help/idea/using-git-integration.html) - [Tutorial: Getting started with Git in IntelliJ IDEA](https://www.jetbrains.com/help/idea/working-with-git-tutorial.html) - [Set up a Git repository](https://www.jetbrains.com/help/idea/set-up-a-git-repository.html) - [Add files to Git and track changes](https://www.jetbrains.com/help/idea/adding-files-to-version-control.html) - [Sync with a remote Git repository (fetch, pull, update)](https://www.jetbrains.com/help/idea/sync-with-a-remote-repository.html) - [Commit and push changes to Git repository](https://www.jetbrains.com/help/idea/commit-and-push-changes.html) - [Merge, rebase, or cherry-pick to apply changes](https://www.jetbrains.com/help/idea/apply-changes-from-one-branch-to-another.html) - [Manage Git branches](https://www.jetbrains.com/help/idea/manage-branches.html) - [Use Git worktrees](https://www.jetbrains.com/help/idea/use-git-worktrees.html) - [Sign commits with GPG keys](https://www.jetbrains.com/help/idea/set-up-GPG-commit-signing.html) - [Compare file and folder versions using Diff viewer](https://www.jetbrains.com/help/idea/comparing-file-versions.html) - [Investigate changes in Git repository](https://www.jetbrains.com/help/idea/investigate-changes.html) - [Resolve Git conflicts](https://www.jetbrains.com/help/idea/resolve-conflicts.html) - [Group changes into changelists](https://www.jetbrains.com/help/idea/managing-changelists.html) - [Shelve or stash changes](https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html) - [Use patches](https://www.jetbrains.com/help/idea/using-patches.html) - [Undo changes in Git repository](https://www.jetbrains.com/help/idea/undo-changes.html) - [Use tags to mark specific Git commits](https://www.jetbrains.com/help/idea/use-tags-to-mark-specific-commits.html) - [Edit Git project history](https://www.jetbrains.com/help/idea/edit-project-history.html) - [Git integration with issue trackers](https://www.jetbrains.com/help/idea/handling-issues.html) - [GitHub](https://www.jetbrains.com/help/idea/github.html) - [GitLab](https://www.jetbrains.com/help/idea/gitlab.html) - [Mercurial](https://www.jetbrains.com/help/idea/using-mercurial-integration.html) - [Perforce](https://www.jetbrains.com/help/idea/using-perforce-integration.html) - [Subversion](https://www.jetbrains.com/help/idea/using-subversion-integration.html) - [Version control integration support](https://www.jetbrains.com/help/idea/enabling-version-control.html) - [Main version control shortcuts](https://www.jetbrains.com/help/idea/main-version-control-shortcuts.html) - [Version control settings](https://www.jetbrains.com/help/idea/settings-version-control.html) - [AI](https://www.jetbrains.com/help/idea/ai.html) - [Remote development](https://www.jetbrains.com/help/idea/remote.html) - [Dev Containers](https://www.jetbrains.com/help/idea/dev-containers-starting-page.html) - [Integrated tools](https://www.jetbrains.com/help/idea/integrated-tools.html) - [Web development](https://www.jetbrains.com/help/idea/web-development.html) - [Database Tools and SQL](https://www.jetbrains.com/help/idea/relational-databases.html) - [JVM frameworks](https://www.jetbrains.com/help/idea/jvm-frameworks.html) - [Kotlin](https://www.jetbrains.com/help/idea/get-started-with-kotlin.html) - [Scala](https://www.jetbrains.com/help/idea/get-started-with-scala.html) - [Groovy](https://www.jetbrains.com/help/idea/groovy.html) - [Non-JVM technologies](https://www.jetbrains.com/help/idea/non-jvm-technologies.html) - Reference 1. [Version control](https://www.jetbrains.com/help/idea/version-control-integration.html) 2. [Git](https://www.jetbrains.com/help/idea/using-git-integration.html) 3. [Undo changes in Git repository](https://www.jetbrains.com/help/idea/undo-changes.html#0) # Undo changes in Git repository Last modified: 06 November 2025 ### Revert uncommitted changes You can always undo the changes you've made locally before you commit them: 1. In the Commit tool window (`Alt``00`) , select one or more files that you want to revert, and select Rollback from the context menu, or press `Ctrl``Alt``0Z`. 2. In the dialog that opens, check the list of files to be reverted. Select the Delete local copies of added files checkbox to revert added files as well as your changes in modified ones. All changes made to the selected files since the last commit will be discarded, and they will disappear from the active changelist. ### Unstage files By default, IntelliJ IDEA uses the [changelists](https://www.jetbrains.com/help/idea/managing-changelists.html) concept where modified files are staged automatically. - If a file is already under version control, and you do not want to commit it, you can: - [Remove it from the commit](https://www.jetbrains.com/help/idea/adding-files-to-version-control.html): do not select it in the Changes area of the Commit tool window. - [Move it to another changelist](https://www.jetbrains.com/help/idea/managing-changelists.html#move-between-changelists). - If you are more used to the staging concept, select the Enable staging area option in the Version Control \| Git settings page `Ctrl``Alt``0S`. Also, by default IntelliJ IDEA suggests adding each newly created file under version control. You can change this behavior in Settings \| Version Control \| Confirmation using When files are created and When files are deleted settings respectively. ### Undo the last commit IntelliJ IDEA allows you to undo the last commit in the current branch. > ### note > You cannot undo a commit if it was pushed to a protected branch, that is a branch to which [force --push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) is not allowed (configure protected branches in the Version Control \| Git settings page `Ctrl``Alt``0S`) Note that if a branch is marked as protected on GitHub, IntelliJ IDEA will automatically mark it as protected when you check it out. 1. Open the Git tool window `Alt``09` and switch to the Log tab. 2. Select the last commit in the current branch and choose Undo Commit from the context menu. 3. In the dialog that opens, select a changelist where the changes you are going to discard will be moved. You can either select an existing changelist from the Name list, or specify the name of a new changelist (the commit message is used by default). Type an optional comment. When the new changelist is submitted to the repository, this comment will appear in the Comment text area of the Commit Changes dialog. 4. Select the Set active option if you want to make the changelist with the changes you are about to discard the active changelist. 5. Select the Track context option if you want IntelliJ IDEA to remember your context and reload currently opened files in the editor when this changelist becomes active. ### Revert a pushed commit If you notice an error in a specific commit that has already been pushed, you can revert that commit. This operation results in a new commit that reverses the effect of the commit you want to undo. Thus, the project history is preserved, as the original commit remains intact. 1. Locate the commit you want to revert in the Log tab of the Git tool window `Alt``09`, right-click it and select Revert Commit from the context menu. This option is also available from the context menu of a commit in the file [History](https://www.jetbrains.com/help/idea/version-control-tool-window-history-tab.html) view. The Commit Changes dialog will open with an automatically generated commit message. > ### note > If you apply this action to multiple commits selected in the Log view, a separate commit will be created to revert each of them. 2. If the selected commit contains several files, and you only need to revert some of them, deselect the files you do not want to touch. 3. Click Commit to commit a changeset that reverts the changes to the selected files in this particular commit. ### Revert selected changes IntelliJ IDEA lets you undo selected changes from a pushed commit if this commit contains multiple files and you only need to revert some of them. 1. In the Log view select the commit containing the changes you want to discard. 2. In the [Changed Files](https://www.jetbrains.com/help/idea/log-tab.html#changedFiles) pane, right-click the file that you want to revert and select Revert Selected Changes from the context menu. This results in a new commit that reverses the changes you want to undo. ### Drop a commit Unlike [reverting a commit](https://www.jetbrains.com/help/idea/undo-changes.html#revert-commit), which is reflected in the branch history, you can discard a pushed commit in the current branch without leaving any traces of the operation. > ### warning > Like any operation that [rewrites a branch](https://www.jetbrains.com/help/idea/edit-project-history.html) history, dropping a commit requires using [force push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) and cannot be performed in protected branches (these can be configured in the Version Control \| Git settings page `Ctrl``Alt``0S`). - Select a commit you want to discard in the Log view and choose Drop Commit from the context menu. ### Drop selected changes from a commit If you have committed changes in several files and now want to roll back some of these changes before pushing your commit, instead of [dropping an entire commit](https://www.jetbrains.com/help/idea/undo-changes.html#drop-git-commit), you can drop only some of these changes. Note that the dropped changes will be deleted. 1. In the Log tab of the Git tool window `Alt``09`, select the local branch and then the commit with the changes you want to drop. 2. In the Changed Files pane on the right, select the files with the changes you want to drop, right-click them, and select Drop Selected Changes. > ### tip > If the commit was already pushed, it is still possible to drop the selected changes. However, you will have to either [use force push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) (cannot be performed in protected branches) or [update your project](https://www.jetbrains.com/help/idea/sync-with-a-remote-repository.html#update-git-branch) first to sync the local branch with the remote tracked branch and then push the merge commit. ### Reset a branch to a specific commit If you notice an error in a set of recent commits and want to redo that part, you can roll back your repository to a specific state. This is done by resetting the current branch HEAD to a specified commit (and optionally resetting the index and working tree if you prefer not to reflect the undo in the history). 1. Open the Version Control tool window `Alt``09` and switch to the Log tab. 2. Select the commit that you want to move HEAD onto and select Reset Current Branch to Here from the context menu. 3. In the Git Reset dialog that opens, select how you want your working tree and the index to be updated and click Reset: - Soft: all changes from commits that were made after the selected commit will be staged (that means they will be moved to the Commit window so that you can review them and commit later if necessary). - Mixed: changes made after the selected commit will be preserved but will not be staged for commit. - Hard: all changes made after the selected commit will be discarded (both staged and committed). - Keep: committed changes made after the selected commit will be discarded, but local changes will be kept intact. ### Get a previous revision of a file If you need to revert a single file instead of discarding a whole commit that includes changes to several files, you can return to a particular version of that file: 1. Select the necessary file in any view (the Project tool window (`Alt``01`) , the editor, the Commit window, and so on). 2. Select Git \| Selected File \| Show History from the main menu or Git \| Show History from the context menu of the selection. The History tab is added to the Git tool window showing the history for the selected file and allowing you to review and compare its revisions. 3. When you've identified the revision you want to roll back to, select it in the list and choose Get from the context menu. Thanks for your feedback\! Was this page helpful? Yes No - [Undo changes in Git repository](https://www.jetbrains.com/help/idea/undo-changes.html) - [Revert uncommitted changes](https://www.jetbrains.com/help/idea/undo-changes.html#revert-local-changes) - [Unstage files](https://www.jetbrains.com/help/idea/undo-changes.html#unstage-files) - [Undo the last commit](https://www.jetbrains.com/help/idea/undo-changes.html#revert-last-commit) - [Revert a pushed commit](https://www.jetbrains.com/help/idea/undo-changes.html#revert-commit) - [Revert selected changes](https://www.jetbrains.com/help/idea/undo-changes.html#revert-selected) - [Drop a commit](https://www.jetbrains.com/help/idea/undo-changes.html#drop-git-commit) - [Drop selected changes from a commit](https://www.jetbrains.com/help/idea/undo-changes.html#drop-selected-changes-from-a-commit) - [Reset a branch to a specific commit](https://www.jetbrains.com/help/idea/undo-changes.html#reset-HEAD) - [Get a previous revision of a file](https://www.jetbrains.com/help/idea/undo-changes.html#revert-single-file) [Use patches](https://www.jetbrains.com/help/idea/using-patches.html) [Use tags to mark specific Git commits](https://www.jetbrains.com/help/idea/use-tags-to-mark-specific-commits.html) - [What's new](https://www.jetbrains.com/idea/whatsnew/) - [Issue tracker](https://youtrack.jetbrains.com/issues/IDEA) - [Submit support request](https://intellij-support.jetbrains.com/hc/en-us/requests/new?ticket_form_id=66731) - [Privacy & Security](https://www.jetbrains.com/privacy-security/) - [Terms Of Use](https://www.jetbrains.com/legal/docs/company/useterms/) - [Trademarks](https://www.jetbrains.com/legal/trademarks/) - [Legal](https://www.jetbrains.com/legal/#licensing) Copyright © 2000–2026 JetBrains s.r.o.
Readable Markdown
Last modified: 06 November 2025 Revert uncommitted changes You can always undo the changes you've made locally before you commit them: 1. In the Commit tool window (`Alt``00`) , select one or more files that you want to revert, and select Rollback from the context menu, or press `Ctrl``Alt``0Z`. 2. In the dialog that opens, check the list of files to be reverted. Select the Delete local copies of added files checkbox to revert added files as well as your changes in modified ones. All changes made to the selected files since the last commit will be discarded, and they will disappear from the active changelist. Unstage files By default, IntelliJ IDEA uses the [changelists](https://www.jetbrains.com/help/idea/managing-changelists.html) concept where modified files are staged automatically. - If a file is already under version control, and you do not want to commit it, you can: - [Remove it from the commit](https://www.jetbrains.com/help/idea/adding-files-to-version-control.html): do not select it in the Changes area of the Commit tool window. - [Move it to another changelist](https://www.jetbrains.com/help/idea/managing-changelists.html#move-between-changelists). - If you are more used to the staging concept, select the Enable staging area option in the Version Control \| Git settings page `Ctrl``Alt``0S`. Also, by default IntelliJ IDEA suggests adding each newly created file under version control. You can change this behavior in Settings \| Version Control \| Confirmation using When files are created and When files are deleted settings respectively. Undo the last commit IntelliJ IDEA allows you to undo the last commit in the current branch. > ### note > You cannot undo a commit if it was pushed to a protected branch, that is a branch to which [force --push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) is not allowed (configure protected branches in the Version Control \| Git settings page `Ctrl``Alt``0S`) Note that if a branch is marked as protected on GitHub, IntelliJ IDEA will automatically mark it as protected when you check it out. 1. Open the Git tool window `Alt``09` and switch to the Log tab. 2. Select the last commit in the current branch and choose Undo Commit from the context menu. 3. In the dialog that opens, select a changelist where the changes you are going to discard will be moved. You can either select an existing changelist from the Name list, or specify the name of a new changelist (the commit message is used by default). Type an optional comment. When the new changelist is submitted to the repository, this comment will appear in the Comment text area of the Commit Changes dialog. 4. Select the Set active option if you want to make the changelist with the changes you are about to discard the active changelist. 5. Select the Track context option if you want IntelliJ IDEA to remember your context and reload currently opened files in the editor when this changelist becomes active. Revert a pushed commit If you notice an error in a specific commit that has already been pushed, you can revert that commit. This operation results in a new commit that reverses the effect of the commit you want to undo. Thus, the project history is preserved, as the original commit remains intact. 1. Locate the commit you want to revert in the Log tab of the Git tool window `Alt``09`, right-click it and select Revert Commit from the context menu. This option is also available from the context menu of a commit in the file [History](https://www.jetbrains.com/help/idea/version-control-tool-window-history-tab.html) view. The Commit Changes dialog will open with an automatically generated commit message. > ### note > If you apply this action to multiple commits selected in the Log view, a separate commit will be created to revert each of them. 2. If the selected commit contains several files, and you only need to revert some of them, deselect the files you do not want to touch. 3. Click Commit to commit a changeset that reverts the changes to the selected files in this particular commit. Revert selected changes IntelliJ IDEA lets you undo selected changes from a pushed commit if this commit contains multiple files and you only need to revert some of them. 1. In the Log view select the commit containing the changes you want to discard. 2. In the [Changed Files](https://www.jetbrains.com/help/idea/log-tab.html#changedFiles) pane, right-click the file that you want to revert and select Revert Selected Changes from the context menu. This results in a new commit that reverses the changes you want to undo. Drop a commit Unlike [reverting a commit](https://www.jetbrains.com/help/idea/undo-changes.html#revert-commit), which is reflected in the branch history, you can discard a pushed commit in the current branch without leaving any traces of the operation. > ### warning > Like any operation that [rewrites a branch](https://www.jetbrains.com/help/idea/edit-project-history.html) history, dropping a commit requires using [force push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) and cannot be performed in protected branches (these can be configured in the Version Control \| Git settings page `Ctrl``Alt``0S`). - Select a commit you want to discard in the Log view and choose Drop Commit from the context menu. Drop selected changes from a commit If you have committed changes in several files and now want to roll back some of these changes before pushing your commit, instead of [dropping an entire commit](https://www.jetbrains.com/help/idea/undo-changes.html#drop-git-commit), you can drop only some of these changes. Note that the dropped changes will be deleted. 1. In the Log tab of the Git tool window `Alt``09`, select the local branch and then the commit with the changes you want to drop. 2. In the Changed Files pane on the right, select the files with the changes you want to drop, right-click them, and select Drop Selected Changes. > ### tip > If the commit was already pushed, it is still possible to drop the selected changes. However, you will have to either [use force push](https://www.jetbrains.com/help/idea/commit-and-push-changes.html#force-push) (cannot be performed in protected branches) or [update your project](https://www.jetbrains.com/help/idea/sync-with-a-remote-repository.html#update-git-branch) first to sync the local branch with the remote tracked branch and then push the merge commit. Reset a branch to a specific commit If you notice an error in a set of recent commits and want to redo that part, you can roll back your repository to a specific state. This is done by resetting the current branch HEAD to a specified commit (and optionally resetting the index and working tree if you prefer not to reflect the undo in the history). 1. Open the Version Control tool window `Alt``09` and switch to the Log tab. 2. Select the commit that you want to move HEAD onto and select Reset Current Branch to Here from the context menu. 3. In the Git Reset dialog that opens, select how you want your working tree and the index to be updated and click Reset: - Soft: all changes from commits that were made after the selected commit will be staged (that means they will be moved to the Commit window so that you can review them and commit later if necessary). - Mixed: changes made after the selected commit will be preserved but will not be staged for commit. - Hard: all changes made after the selected commit will be discarded (both staged and committed). - Keep: committed changes made after the selected commit will be discarded, but local changes will be kept intact. Get a previous revision of a file If you need to revert a single file instead of discarding a whole commit that includes changes to several files, you can return to a particular version of that file: 1. Select the necessary file in any view (the Project tool window (`Alt``01`) , the editor, the Commit window, and so on). 2. Select Git \| Selected File \| Show History from the main menu or Git \| Show History from the context menu of the selection. The History tab is added to the Git tool window showing the history for the selected file and allowing you to review and compare its revisions. 3. When you've identified the revision you want to roll back to, select it in the list and choose Get from the context menu.
Shard95 (laksa)
Root Hash2692805634082760095
Unparsed URLcom,jetbrains!www,/help/idea/undo-changes.html s443