How to undo a commit in a local branch - git
I did some commits in a local branch through intellij in multiple git repositories. How can I undo those commits? I need the code changes after the undo (marked them as local changes).
Please sign in to leave a comment.
To undo local unpushed commits in Git you have to use the reset command. If you want to keep code changes, you need the "mixed" mode (which is the default mode).
There is also VCS | Git | Reset HEAD action in IntelliJ IDEA, but it doesn't support multiple repositories.
Vladimir Varbanov
Yes, commits can be removed only with an interactive rebase. In IDEA 2020.1, you need to call the Interactively Rebase from Here action from the context menu.
Have you specified which commit to reset to? For example, if you want to roolback one commit, you should refer to HEAD^. Or you can specify the target commit hash.
I encourage you to read the link to the article I gave in the previous message, if you're not very familiar with git reset syntax.
Hi guys,
one thing on the subject:
I have to remove a commits after rebase, but hey are chronologically before my latest - how can I do that from the Webstorm Git panel?
EDit: By interactively rebasing I guess :)
True. And I've got them done. Thank you Dmitriy!
I tried to follow what you said "VCS | Git | Reset HEAD" but nothing changes when I do that. I get the a pop up (snapshot attached) to which I click "Reset". Nothing changes. The commit is not rolled back.
Did I misunderstood your solution?
Note - I am using Intellij 12.0.2 Ultimate edition
Attachment(s):
undo_commit.jpg