Working with git and intellij I have accidently commmited my changes to my local branch.
I want to revert the commmit but keep the changes as before (ready for next commit).
I have looked in this page explaining me how to revert a commit but failed to understand the reset type meaning (mixed/head/soft).
I want to have all my changes as before in order to keep working on them.
Any help on how to it?
The easiest way to undo the last Git commit is to execute the “git reset” command with the “–soft” option that will preserve changes done to your files. You have to specify the commit to undo which is “HEAD~1” in this case. The last commit will be removed from your Git history.
Revert changes For most recent changes, including refactorings, press Ctrl+Z or choose Edit | Undo from the menu.
If it's a single commit that you want to place back into staging, then you can do the following command:
git reset --soft HEAD^
You can replicate that in IntelliJ through these steps:
HEAD^
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