2

I have a Git repo with two massively diverged branches A and B:

  • A is the upstream branch of the open source software
  • B are all changes we made to it (from a very early commit from A as a starting point)

What we would like to have is

  • A as above
  • B having all the changes we want to make available to the upstream developers
  • C with all the changes which only apply to our specific use of the software

So I find myself in the situation of having to split up the changes in B into two parts and commit them to different branches. What I did until now is to have two checkouts of the repository (B and C)

Is there a built-in git tool or a workflow that handles this case?

tshepang
  • 12,111
  • 21
  • 91
  • 136
moritz
  • 25,477
  • 3
  • 41
  • 36

1 Answers1

3

Simply create a C branch, and cherry-pick the relevant commits from B to C.

I generally avoid cherry-picking because it duplicates commits and can create functional dependencies errors.

But in your case, if 'C' isn't merged back to any other branch, it is a good solution.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, thats a start. The problem is that it does only work if a set of changes from one commit does never have to be split up into different commits. Unfortunately, this is the case a lot. Do you have an idea to solve also that? – moritz Aug 26 '13 at 14:28