reverting push'd git commit

前端 未结 2 1266
不思量自难忘°
不思量自难忘° 2020-12-31 12:09

I\'ve got a repo with two branches-- master and dev. I was working on the master branch and pulled, and got a message that the repo was up to date. I committed my changes, a

2条回答
  •  梦毁少年i
    2020-12-31 12:43

    The git reset --hard [sha] will correct the branch on your local repository. To force this push to work, you can do a git push origin +master:master. The + sign will force the non-linear push to work.

    If the other developers have already pulled you wrong commit, they will have to do a git remote update, then a git reset --hard origin/master (provided that they are on their master branch, and have not made any other commits.

    Please use these commands with some caution :-). Good luck.

提交回复
热议问题