Jan 12

Reset your last commit in git

So, you committed a change in your local repo and then realized you had the wrong branch? This happens to me a lot and the command I found the most useful for this purpose is:

git reset --soft HEAD^

git reset

Run the above 2 commands and you will have your uncommitted files back. After that you can switch to the right branch and commit them again.