


We are saved from embarrassment! The project is working again. The outcome of this revert is that Git will create a new commit that rolls back the changes from the merge. The scenario: I had several uncommitted changes on a branch, realized I forgot to create a new branch to develop the new feature, copied the current branch to the new feature branch, forgot to commit the changes on the new.
#PHPSTORM GIT UNDO COMMIT HOW TO#
I am trying to figure out how to undo a git rollback of uncommitted changes. The -m followed by the 1 indicates that we want to keep the parent side of the merge (the branch we are merging into). Git: undo rollback of uncommited changes. We specify the merge using the SHA 1 hash of the merge commit. git revert -m 1 dd8d6f587fa24327d5f5afd6fa8c3e604189c8d4> In my new video course, I cover all the essential features of PhpStorm like Refactoring, Testing, Debugging and Git in. We can also specify the exact merge commit that we want to revert using the same revert command but with a couple additional options. To revert the previous commit (our merge commit), we do: git revert HEAD In the Log view select the commit containing the changes you want to discard.

I need to save myself from further embarrassment in front of my team, so let’s undo the merge into develop.īecause the merge is a commit that points the HEAD to a specific commit, we can undo the merge commit and roll back to the pre-merge state. PhpStorm lets you undo selected changes from a pushed commit if this commit contains multiple files and you only need to revert some of them. My merge of my_feature_branch into develop broke the site. We also have a develop branch that I merge into and deploy to my testing/staging server. We have a my_feature_branch that I’ve been working in. Sometimes you get in a situation - and this is a no-judgement zone, we’ve all been there - where you merge branches and you messed up and need to undo the merge because, well, because your co-workers are kind of mad you broke the project.
