0

I'm trying to understand git rebase, but I'm having issues. I've read a number of forum posts and documentation to see if I can pin this down but the behavior seems odd to me so I can't wrap my head around it.

Let's say I have a file, called test.txt.

I have a branch, Branch A:

text.txt in Branch A:

Hello, World!

Good... Thanks for asking!

and in Branch B the text.txt file looks like:


-> How are you, robot?

I need both changes (let's pretend this isn't an easy copy and paste fix... I need to rebase).

So...

git checkout Branch B

git rebase Branch A

And then a merge conflict happens. It asks me if I want to keep one or the other...

<<<<<<<<<<<<<<<<< 1234123hpdfaskdjf123234
Hello, World!

Good... Thanks for asking!
==========

-> How are you, robot?

>>>>>>>>>>>>>>>> some commit message

1) What do I do if I need both? 2) Do I only use one or the other or do I use a combination of both of them? 3) If I use one, will the other block be available later?

Frank
  • 915
  • 1
  • 7
  • 22

1 Answers1

1

1) If you need both, just delete the conflicting marks <<<<<, =====, >>>>> and leave the rest alone.

2) It depends on which lines you want to keep and which to remove. It's not either-or.

3) The other block is not available from the commit created after resolving the conflicts. But it still exists in the outsider commit.

In fact, you can even remove all the lines and input something else completely new. Which contents should be committed depends on your real needs. The conflicting marks should be always removed.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
  • Right right. It sounds like my miss-step is assuming it’s this automated, cut and dry process. – Frank Apr 09 '19 at 03:21