Git undo changes

I have two repository, one bare server and the other on my car.
I want to undo the changes of the last two commits.

doing git reset 6fa93cb0a07c9b9b5dbd03d5dfa861c1fe23afc8 //reset to the necessary revision

doing git pull

I naturally respond
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'root@123.123.123.123:/repositories/repo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.

If I do git pull I have back those branches that I do not need.

Question: how to rollback the changes?
October 8th 19 at 01:00
2 answers
October 8th 19 at 01:02
git reset 6fa93cb0a07c9b9b5dbd03d5dfa861c1fe23afc8
git push -f origin master
It is not good to do (push --force). Will be a big problem when trying to sync with the repository from other clients. There is a rule that you can't modify history komitov that are available to the public. It is for this reason. - denis9 commented on October 8th 19 at 01:05
I use the repository one, please tell me how to do it right? - Nora_Hya commented on October 8th 19 at 01:08
git revert - denis9 commented on October 8th 19 at 01:11
git revert will create another commit, why do it when the author is the only user of the repository? do as ataraev advises, it's more like what You are trying to achieve. - xander_Kozey commented on October 8th 19 at 01:14
well, or do git reset on the server. The essence is the same. - xander_Kozey commented on October 8th 19 at 01:17
I learned about git revert, thank you. - Nora_Hya commented on October 8th 19 at 01:20
Curtain) - koby_Zboncak82 commented on October 8th 19 at 01:23
PS. By the way, to remove the commits, push --force harmless. Well, even more so if one is working with him. But of course two of revert-commit makes the story more impressive :) - koby_Zboncak82 commented on October 8th 19 at 01:26
Removal from head — harmless (just deleted so commits back when saramirisa someone unedited story). Deletion from the middle gives rise to a new chain of commits, not having anything in common with the original. Two revert komita do not necessarily — can be merged into one. - denis9 commented on October 8th 19 at 01:29
October 8th 19 at 01:04

Find more questions by tags Git