我创建了三个分支。硕士,分期和发展。暂存和开发分支来自 master。现在,我想取出开发分支并对其进行更改,使其应该从暂存分支中出来。基本上我需要移动分支的原点。有什么办法吗?考虑到每个分支中没有代码,并且考虑到每个分支中都有一些代码。
2 回答
If you don't have anything committed to any of those branches, it's easy: They all point to the same commit. You don't have to do anything there.
However, if you do have some code in staging and you also have some in dev, and they both started from the same place. If you now want dev to start from the latest changes in staging, all you need to do is
git rebase staging
when you have the dev branch checked out. For a good explanation of the workflow I think you are trying to achieve, have a read of my article here: http://dymitruk.com/blog/2012/02/05/branch-per-feature/
你想使用git-rebase:
git checkout development
git rebase Staging
更多详细信息,Pro Git 电子书对 git 进行了非常清晰的介绍:您可以查看第 3.6 节:rebase