You committed to the wrong branch
The way this plays out for me (again and again!) is that I forget to create a new branch and so make my changes on the develop branch or to main. To fix this, enter:
git branch <new branch>
git reset HEAD~ --hard
You are creating the new branch, then removing the check-in from main (HEAD~
) but leaving the files in the new branch.