I accidentally inserted 1 commit in my local master branch. I have not pushed this changed and I want to remove it. This was supposed to be in a new branch.
So, I created a new branch based on master including the commit. Then, I decided to remove this commit from local master. In my terminal, I can successfully do:
git reset --hard HEAD~1
Since I have been using Emacs, I tried doing the same in Magit. First, on Magit status buffer, I pressed X
(Reset). After, I chose h
(hard). Then, the mini-buffer asked
Hard reset master to (default master):
I pressed enter (choosing default). After that, I decided to inspect the git log
. I was expecting that the last local commit would be discarded. Unfortunately, it was not.