简体   繁体   English

SourceTree:撤消推送提交

[英]SourceTree: undo pushed commit

I have accidentally pushed a large (complete project altering) commit to the wrong repo.我不小心将一个大的(完整的项目更改)提交推到了错误的仓库。

See screenshot.见截图。

截屏

I have locally reverted master to the "good" commit, but I would like to revert origin/master to the "good" commit and prevent the "accident" commit from being pulled by others on the project.我已在本地将 master 恢复为“好”提交,但我想将origin/master恢复为“好”提交,并防止项目中的其他人拉取“意外”提交。

How is the easiest/cleanest way to accomplish this?实现这一目标的最简单/最干净的方法是什么?

A git push -f origin master (in command-line) should be enough. git push -f origin master (在命令行中)应该就足够了。

With SourceTree , after selecting " Enable Forse Push ":使用SourceTree ,选择“ Enable Forse Push ”后:

https://i.stack.imgur.com/lygMh.png

But:但:

prevent the "accident" commit from being pulled by others on the project防止“意外”提交被项目中的其他人拉取

Others might already have pulled from your project: you will have to contact them, asking them to fetch and reset their own local master branch to the new origin/master .其他人可能已经从你的项目中拉取了:你必须联系他们,要求他们获取并重置他们自己的本地master分支到新的origin/master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM