Merging Git Flow Feature Branch after Hotfixes?
Asked Answered
M

1

12

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?

Morphosis answered 28/4, 2012 at 11:19 Comment(0)
S
16

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.

Springhalt answered 28/4, 2012 at 12:52 Comment(1)
Thanks, I merged develop into my feature branch with no conflicts and everything seems to be as it should. Good stuff, and thanks for the resource link.Morphosis

© 2022 - 2024 — McMap. All rights reserved.