I want to revert my repo to exact state of a previous commit. Then make a new commit (as part of the reversion) and push to remote. I don't want to use git push -f
so I don't want to rewrite the commits. I want to use one new commit and undo multiple changes.
so I ran git checkout [HASH] -- .
But I realized that this command doesn't exactly do the reversion. A file added in the later commits doesn't actually get removed.
How exactly do I revert in git?