Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merging Git Flow Feature Branch after Hotfixes?

I just recently started using git flow and there's something I don't quite understand. First, I never do anything directly on develop. If I do something I either use a start a hotfix or feature.

My plugin was at version 1.1.5 when I started a new feature ('sequentialUpgrades'). That was 4 days ago. In the last 4 days, while having not finished this new feature, I completed 2 hotfixes, so those were merged back into master, then develop upon finishing them and on both of those branches of course I have the latest changes including the hotfixes and am at version 1.1.7... If I do a git diff master develop, there's no difference.

Now when I went back into my feature branch to continue dev'ing this new feature, the feature branch is still back at 1.1.5, so I don't have the 2 latest hotfixes.

So I have 2 questions:

  1. How if any way to get the latest changes into my feature branch without messing something up?

I was thinking to merge develop into the feature branch, but I don't think that's right way to go about it. But, I would really like, scratch that NEED these last 2 fixes present while developing this new feature.

  1. If I'm not able to do this, when I finish the feature, how in the heck does it now merge back into develop without any conflicts? I can't wrap my head around this.

Because I started this feature back at 1.1.5. In the feature branch I made significant changes to a file access-level.php. When I did the hotfixes I changed maybe 5-6 lines in the same file. How can a file who is all they way back at 1.1.5 with some significant changes be merged into the same file at 1.1.7 which has had changes since then as well?

like image 470
FueledPublishing Avatar asked Apr 28 '12 11:04

FueledPublishing


1 Answers

There's nothing wrong with occasionally merging develop into your feature branch to keep it up to date. git is pretty good at merging, but if both branches touched the same parts of a file, you'll probably have to resolve some conflicts manually. I prefer to use a graphical merge tool for conflict resolution, see e.g. this guide for some tips how to set that up.

like image 83
Benjamin Wohlwend Avatar answered Oct 14 '22 22:10

Benjamin Wohlwend