I accidentally commited to branch dev, instead of feature-branch, and pushed to the remote. Based on the advice from git undo commit on protected branch?, I took the following steps to undo the commit on dev and commit it to feature-branch
on dev, undo the commit locally and stash it, so I can later commit it to feature-branch:
git reset --soft HEAD~1git restore --staged .git stashgit pullgit revert SHA-1git commit -m "reverting commit made to wrong branch"git push
on feature-branch:
git stash popgit add .,git commit -m "making commit in the right place"
Great. At this point, dev is back to where it was before I wrongfully made the commit there, and feature-branch has the new changes. I then did some more work and added more commits to feature-branch.
After creating a pull request from feature-branch to dev and merging it in, it seems the commit that was reverted is not present on dev.
What is happening here?
For now I will just create a new branch and manually rewrite the commit, but I don't comprehend why this series of events has led me to see a diff in my IDE (vscode and gitlens), but github is telling me there is no diff?