如何使用git重新设置分支到另一个分支? [英] How to reset a branch to another branch with git?
问题描述
master
创建的修补程序
分支。我们添加了对修补程序
的提交,但那些提交没有用处,所以现在我们要从一个全新的 master
再次。澄清更好,这是参考工作流程: http://nvie.com/posts/a-successful-git-branching-model/
让我们还说我们把 hotfixes
放到 origin
remote中,因为我们有一个糟糕的设置,这是测试的唯一方法所以我们需要在远程服务器上重置分支。
如何将修补程序
重置为副本 master
?
你的意思是你想推送你的本地 master
到远程修补程序
分支?像这样:
git push origin + master:hotfixes
但是,这要求您可以在远程端重写历史记录。
let's say that we have an hotfixes
branch which was created from master
. we added commits to hotfixes
, but those commits were not useful, so now we want to start from a fresh copy of master
again.
to clarify better, this is the reference workflow: http://nvie.com/posts/a-successful-git-branching-model/
let's also say that we pushed hotfixes
to the origin
remote because we have an awful set up and that's the only way to test something, so we need to reset the branch also on the remote server.
how to reset hotfixes
to a copy of master
?
You mean you want to push your local master
to the remote hotfixes
branch? Like this:
git push origin +master:hotfixes
However, this requires that you are allowed to re-write the history on the remote side.
这篇关于如何使用git重新设置分支到另一个分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!