I previously used Tower for Mac to manage my git repository. I'm trying to make the switch to using PhpStorm to manage my git repo but it seems to be missing some features.
In Tower there is an "Abort" button which allows me to easily undo my messed up merge and start over. Simply click the "Abort" button and it reverts everything perfectly like you never even started the merge.
Tower for Mac Abort Merge Button
Is there a simple way to abort/undo a merge in PhpStorm?
How do I cancel a git merge? Use git-reset or git merge --abort to cancel a merge that had conflicts. Please note that all the changes will be reset, and this operation cannot be reverted, so make sure to commit or git-stash all your changes before you start a merge.
On the command line, a simple "git merge --abort" will do this for you. In case you've made a mistake while resolving a conflict and realize this only after completing the merge, you can still easily undo it: just roll back to the commit before the merge happened with "git reset --hard " and start over again.
Locate the commit you want to revert in the Log tab of the Git tool window Alt+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.
So the “git merge –abort” operation essentially terminates the merger that you have just carried out and separated the two versions of your file, i.e., the current version and the older version.
GUI
In new versions of phpStorm use the function "Git" -> "Abort Merge". In old versions use "VCS" -> "Git" -> "Reset Head" and choose the "Hard" option.
You will lose all changes, so be careful.
CLI
git merge --abort
If you only want to undo the changes to a single file somefile
then you can try the following:
git checkout -- path/to/somefile
In case you want to undo the entire merge operation, then git reset
will come in handy:
git reset --hard HEAD
Both of these operations are resetting the state to the HEAD
of the branch, which is the last commit made before you attemtped a merge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With