I have a feature branch, let's call it feature/JIRA-1000. On this branch I had a commit with a message that we can call "It works."
After this, I refactored the code significantly and commited the changes as "Refactoring." However, then I realized, I should have made the changes as part of another task (JIRA 2000), on a separate branch. So from JIRA, I created a new branch feature/JIRA-2000, based on feature/JIRA-1000. That new branch thus contained both the "It works" and the "Refactoring" commit.
Then I wanted to remove the "Refactoring" commit from the feature/JIRA-1000 branch. So in Gitkraken, I right-clicked the "It works" committ and selected "Reset -> hard". I have also tried it from Git Bash:
$ git checkout feature/JIRA-1000
Already on 'feature/JIRA-1000'
Your branch is up to date with 'origin/feature/JIRA-1000'.
$ git reset --hard f9ef772b188ae359a77804b63a79aa542fd44e6b
HEAD is now at f9ef772 SERDOC-1000 It works
$ git push -f
Everything up-to-date
But now comes the catch: My local files are not changed.
What am I doing wrong?
Gitkraken might have messed something up as I believe I had some unstaged changes when I first ran the command and I can see a commit entry that says:
Merge remote-tracking branch 'origin/feature/JIRA-1000' into feature/JIRA-1000
at the top of my branch history. But anyway, JIRA-2000 is the way it should be now. I just can't revert JIRA-1000 back to the way I want it to be.
Edit: I just accidentally repeated the hard reset on the JIRA-2000 branch (the new branch I didn't want to reset). The hard reset in this case did reset my local changes. (Thankfully, I was able to undo this by hard resetting again to the "Refactoring" commit). So maybe my JIRA-1000 branch is somehow broken?