I pushed onto my branch with git push origin branch
. I then realized that I made a small mistake in this commit. I didn't want to revert because a large part of the commit was correct, only a small change was needed. Instead of reverting, I git reset --soft <previous-commit>
such that I did not lose my staged files. I then committed the fix to the small mistake. Unfortunately, I realized the hard way that I couldn't push after doing so, since the most recent commit on my local and remote were out of sync.
For instance.
A-B-C-D // Local, before git reset --soft
A-B-C-D // Remote
A-B-C // Local, after git reset --soft
A-B-C-E // Local, after new commit.
What should I be doing in this situation so that remote reflects local? What would git push -f origin branch
do in this case?
Thanks