parker.sikand
parker.sikand

Reputation: 1381

git branching workflow

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.

Upvotes: 3

Views: 202

Answers (1)

Venki
Venki

Reputation: 1459

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.

Upvotes: 1

Related Questions