假设我们有一个hotfixes
分支是从创建的master
。我们添加了承诺hotfixes
,但是这些提交没有用,所以现在我们想从新的副本开始master
again.
为了更好地澄清,这是参考工作流程:http://nvie.com/posts/a-successful-git-branching-model/ http://nvie.com/posts/a-successful-git-branching-model/
我们还说我们推动了hotfixes
to the origin
远程,因为我们的设置很糟糕,这是测试某些东西的唯一方法,所以我们还需要在远程服务器上重置分支。
如何重置hotfixes
的副本master
?
这就是我使用基本 Git 命令的方法:
git checkout hotfixes
git reset --hard master
git push --force origin hotfixes
当然,通知每个从事该工作的人很重要hotfixes
。他们很可能必须删除本地副本并从新的开始。另一种侵入性较小的想法是创建一个新分支:
git checkout master
git branch -tb hotfixes-2 # this creates branch `hotfixes-2` from a copy of `master`
git push origin HEAD # this creates `hotfixes-2` on the remote server
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)