1

I have two branches and one of them is always up to date with master by rebasing, but after a few changes I have some conflicts between two branches and rebasing got a bit painful. Now I wonder is there a way to get the latest commit from master, as I did a rebase?
I have this:

-- -- -- -- -- XX (Master) \ -- -- -- -- -- (Branch 2) 

I want a PAINLESS WAY to get this:

-- -- -- -- -- XX (Master) \ -- -- -- -- -- (Branch 2) 

Rebasing asks to resolve set of conflicts while rewinding commits from Branch 2, though commit XX doesn't have any conflicts with commits on Branch 2. cherry-pick-ing creates new commit which I don't want to have, because it mixes up branches.

10
  • What you are asking to do is to rewrite the history of Branch 2, by introducing one or more new commits from Master, and then replaying commits on your branch on top of this. git rebase is probably the least painful way of doing this. If, as you say, there isn't much friction caused by the new commits in Master, then the rebase should go smoothly. Commented Jan 20, 2017 at 6:36
  • Do you have something against simply merging master into branch2 instead of rebasing? Commented Jan 20, 2017 at 6:40
  • 1
    You're asking to rebase without conflicts, but the additional commit you want will cause conflicts. How do you expect that it will automatically work itself out? You can tell it to automatically resolve conflicts, but it wont necessarily be right. Commented Jan 20, 2017 at 6:52
  • 1
    oh interesting...have you tried --preserve-merges? stackoverflow.com/questions/25670519/… - I've never personally used it, but it seems interesting Commented Jan 20, 2017 at 7:08
  • 1
    This link explained things really well: stackoverflow.com/questions/15915430/… . Since I've never used it, I would definitely read this carefully before using it. Commented Jan 20, 2017 at 7:18

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.