I have a bare git repository B, from which I have cloned two repositories C and D. Then I have added some changed to C which were later pushed to B, and finally pulled by D. So everything is synchronized.
Now I want to remove last pushed commit from C so I do following:
$ git reset HEAD^ --hard
$ git push -f
(from http://christoph.ruegg.name/blog/git-howto-revert-a-commit-already-pushed-to-a-remote-reposit.html)
and on D I do:
$ git pull
and I get output as follows:
[mkm@horklum git1]$ git pull
From /home/mkm/projects/git_tests/git1
+ a5d681f...c481973 master -> origin/master (forced update)
Already up-to-date.
and git log
gives me the exact same output as before. I would like history on D to be the same as on C. I know from What and where does one potentially lose stuff when git says "forced update"? that last git pull
merged my history with the changed one on the server, but is it really what should happen? I would like history to be still synchronized everywhere.
I know I can do git revert commit and this is the recomended aproach in such scenerio, but I would like to understand why in case of forced push, history will not remain synchronized everywhere.