Comprehensive git maneuver

git-rebase looked at the git-rebase man page, I did not see diagrams that looked like what I want (except for some, it looks like I'm doing the opposite, what I want), and --onto didn’t like playing with --onto either.

Let me see if I can draw a diagram like a diagram on the git-rebase man page (the vertical columns on the left are to make Markdown right):

 | oooo-branch2 | / | -ooA-master-o-branch1-oo-my_WIP_branch 

branch1 is probably not very important here, but I included it anyway. I want to do this (excluding ' which usually accompany git-rebase page git-rebase ):

 | oooo-branch2-o-branch1-oo-my_WIP_branch | / |-ooA-master 

Basically, I want to put my work my_WIP_branch into work branch2 , not having to deal with merge conflicts involved in a group of commits marked as A Is there a way to do this differently than manually cherry picking each commit over branch2 (or at least maybe an easy way to do this?)? By the way, there will be merge conflicts, so ideally it should be a git command or a group of git commands that handle them gracefully (for example, git rebase handles them gracefully, git am and git apply do not).

+2
source share
1 answer

Strange ... because it should be a classic rebase --onto case.

You have:

  oooo <--branch2 / oooA <--master \ -oo <--branch1 \ -oo <--my_WIP_branch 

Do you want to:

  -oo <--my_WIP_branch / -oo <--branch1 / oooo <--branch2 / oooA <--master 

It should be:

 $ git rebase --onto branch2 master my_WIP_branch 

it will play any latch not on the main one, but where can you reach my_WIP_branch from (which means that commits from branch 2 are not covered).
See my other SO answer for conflict merging instructions and the "resolving merge conflict " section of the Git manual. (you can accept all merges with your version, for example )

+4
source

All Articles