开发者

Git feature branches workflow

I am trying to contribute to a project and I'd like to use git-flow workflow(?) on what I work. S开发者_开发技巧ay, I have checkout'd the develop branch of the remote repository (github) and that I've setup 2 feature branches (T for Translation, U for Update):

---o---o---o (D)
           |---Ta---Tb (T)
           \---Ua---Ub---Uc (U)

Now, for each of the branches, a pull request is made to the upstream repository maintainer and he accepts them all and merges them to the upstream/develop branch.

What is the correct procedure so that I end up with:

---o---o---Ta---Tb---Ua---Ub---Uc (D)
                               |- (T)
                               \- (U)

Something tells me that git rebase is what I need. (Please note I am on Windows).


You are right. You (or the repository maintainer) needs to rebase your changes onto your develop branch:

git checkout develop
git rebase T
git rebase U

During the rebase, you might need to resolve conflicts if they occur.

Your last branch diagram shows T and U have Uc as their parent. The rebase won't change the branches parent. You can do this by deleting your branches and recreating them after the rebasing above.

git branch -D T
git branch -D U

You'll need to use the capital -D switch to force the branch deletion because the T and U branch was never merged into the develop branch, so git doesn't know that the branch changes are reflected in the develop branch.

After that, you can recreate them:

git checkout -b T

git checkout develop
git checkout -b U
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜