当前位置: 动力学知识库 > 问答 > 编程问答 >

How to git reset hard to other users?

问题描述:

I've done following commands:

git reset --hard <hash-id>

git push -f origin

Everything is ok on my local machine and on bitbucket, pointer is moved and newer commints than that commit () are deleted and that is ok but there is one other problem.

Now when other users do git pull on their local machines pointer is moved to but newer commits are ready to push. To repeate, pointer is moved but newer commits are there on their machines (git is offering push of that commits and they see changes in files).

Every help is welcome.

P.S. they can't do manual changes because there is 100 commits :(

Thank you

网友答案:

Like mentioned here in the second answer:

(you) git reset --hard <hash>
(you) git push -f

(them) git fetch
(them) git reset --hard origin/branch

But, like also mentioned, this could turn into a mess. Before you execute those command you may should backup your repo (one of the local once if you already pushed).

To don't get into this mess you should prefer git revert. For example like that:

git revert HEAD~2..HEAD

Further information is available here and there.

Hope that helps you.

分享给朋友:
您可能感兴趣的文章:
随机阅读: