Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 990
parker.sikand Avatar asked Dec 13 '25 16:12

parker.sikand


1 Answers

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.

like image 92
Venki Avatar answered Dec 15 '25 13:12

Venki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!