By mistake, I did git add .
and git commit
in the develop
branch. But luckily, I did not do git push
.
So I wanted to revert it back to original state.
I tried git reset --soft
and git reset HEAD --hard
but looks like I have messed it up.
How do I fix this? I want to go back to original state and possibly keep the code changes.
This question is related to
git
git-commit
git-reset
git-revert
Try simply to reset last commit using --soft
flag
git reset --soft HEAD~1
Note :
For Windows, wrap the HEAD parts in quotes like git reset --soft "HEAD~1"
Source: Stackoverflow.com