3

I'm having trouble figuring out what to do manage the branches in my project. I have been working on a feature branch, "loads", which was branched off of "dev". Since branching, "dev" has moved forward by a few commits. Now, another developer started a new feature branch, "work", from the latest "dev" commit. The issue is that the features in "work" depend on the functionality in "loads". This functionality in "loads" is completed, but the "loads" branch as a whole is not "done".

Basically, what I want to do is make the latest changes in "loads" available to "work", without ending the life of the "load" branch.

Here's what the tree looks like at the moment:

       (loads:A) -> (loads:B)
      /
(dev:A) -> (dev:B) -> (dev:C)
                            \
                             (work:A)

Here's what I think I need to do

       (loads:A)  ->  (loads:B)  -> (loads:C) //continue work on "loads"
      /                         \
(dev:A) -> (dev:B) -> (dev:C) -> (dev:D)
                            \            \
                             (work:A) -> (work:B) //use "loads" features in "work"

I'm just a little unsure of the exact sequence of merges and whatnot to accomplish this. Last time I was trying to merge branches I royally screwed things up, spent a whole day reverting, and I really don't want to go through that again.

parker.sikand
  • 1,323
  • 1
  • 14
  • 32
  • rebase loads against dev and work against loads after its rebased? – Venki Mar 05 '13 at 18:03
  • if i understand correctly, it's easy-to-fix: merge loads:B into dev:C, you get dev:D; merge dev:D into work:A, you get work:B. that's a branch merge stuff, no need rebasing. – yuwang Mar 05 '13 at 18:05

1 Answers1

1
git checkout loads
//after making code changes
git commit -am "latest changes on loads"


//This will replay your current changes on top of the existing dev
git rebase origin/dev

//Possible merge conflicts might have to address them

//after resolving conflicts
git push origin dev

The other developer can commit his changes if he has already made them on work and rebase them against dev or he can pull your changes from dev and create a new feature branch of that and continue from then on.

Venki
  • 1,274
  • 3
  • 26
  • 37
  • http://mettadore.com/analysis/a-simple-git-rebase-workflow-explained/ suggests I might want to rebase the loads branch first. That tutorial would suggest that I do `git checkout loads; get rebase dev`. What exactly is the intention of your command `git rebase loads`? – parker.sikand Mar 07 '13 at 16:31
  • Doing `git rebase dev` with the loads branch checked out played the entire loads branch on top of the latest dev, which is what I wanted. Is this what you were suggesting to do? – parker.sikand Mar 07 '13 at 17:04
  • ya thats the work flow i intended for other developer. i will tweak those messages again – Venki Mar 07 '13 at 17:10