brycemcd
brycemcd

Reputation: 4543

merge changes in a single file from multiple branches

I have a git repo with two divergent branches, production and v2. I'm working on a third branch with a collaborator that we're merging into called prod-merge. The idea is that v2 has a ton of feature updates and production was a series of bug fixes/patches.

So now v2 should more or less be canonical but I need to merge in the changes from my production branch.

My collaborator and I have split up the workflow such that I'm in charge of merging the 'foo' namespace and he's in charge of merging in the 'bar' namespace. Said another way, I'm responsible for merging in the production branch, foo.rb file. There are several files for each of us.

I've been playing with diff,merge,patch and am without finding a workflow that feels really solid. I'd like a three way merge to make sure I don't miss anything and then commit that merge. What's the simplest solution that could work?

thanks, Bryce

Upvotes: 1

Views: 150

Answers (2)

Adam Dymitruk
Adam Dymitruk

Reputation: 129782

We have lots of very complex branches, branch ownership scenarios, etc. I've documented the approach here. Hope this gives you some good ideas.

https://plus.google.com/109096274754593704906/posts/R4qkeyRadLR

Upvotes: 0

brycemcd
brycemcd

Reputation: 4543

there must be a better way, but I found this to do just the trick:

git format-patch --stdout feature..master -- app/controllers/feeds_controller.rb > ~/Desktop/feeds.patch

git am -3 -i --ignore-date ~/Desktop/feeds.patch

Upvotes: 1

Related Questions