How Not to Revert a Commit

In git it is possible to detach HEAD and branch off from the detached state. You can then assign master to the new branch by updating the refs. If, however, you want to push your changes upstream, it will not be permitted. The master on your local copy will not match the master on the remote copy. The upstream will not update the refs as you did locally. Updating refs is not a commit. It isn’t part of the history.

Use git revert.