且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在同一个Git存储库中同步两个分支?

更新时间:2023-01-22 10:49:43

如果不需要分支:

如果您将foo合并回master,则可以使用"git branch -d foo"杀死主题分支,然后在将来需要再次对其进行黑客攻击时将其"checkout -b foo"合并.

If you've merged foo back to master, "git branch -d foo" to kill the topic branch, and then "checkout -b foo" in the future when you need to hack on it again.

如果您需要以下分支机构:

您可以根据主分支来重新建立主题分支:

You can rebase your topic branch against the master branch:

git checkout foo
git rebase master

或者:

git rebase master foo