2
                   change 1, change 2, change 3, change 4
                  /
master >> Branch A
                  \ Branch A1
                             \
                              change 1001

I have made a branch A from the master at the beginning. Then I have made a branch out of branch (A1).

Over time I have make several changes to Branch A. I have also done some changes to Branch A1.

Now I would like to get only Branch A1's change to master (change 1001), without the changes to Branch A (changes 1-4).

Can this be done easily with git? And if it's possible, what would be appropriate steps to achieve this?

I'm using eGit plugin in Eclipse.

Lemonius
  • 91
  • 1
  • 7
  • 11

1 Answers1

0

You have

x--x--x (master)
       \
        y--y1--change 1, change 2, change 3, change 4 (branchA)
            \
             change 1001 (branchA1)

or:

         change 1001 (branchA1)
       /
x--x--x (master)
       \
        y--y--change 1, change 2, change 3, change 4 (branchA)

In the second case (branchA1 comes from master), you could simply merge branchA1 on master.

But in the first case (branchA1 comes from branchA), you can:

git cherry-pick change 1001

But that would leave some duplicate commits and is subject to functional dependencies.
I try to avoid cherry-picking, if possible.

Or:

git rebase --onto master y1 branchA1

That will move all commits from branchA1 (after y1 of branchA) onto master branch. No duplicate commits

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250