Question

I am trying to contribute to a project and I'd like to use git-flow workflow(?) on what I work. Say, 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).

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top