3

I accidentally merged two branches into each other. (If you want to know how I did that: With gitlab I merged branch A into branch B in the web interface and in SourceTree client I merged B into A. Stupid, I know...)

Then also, because I had to fix something real quick, I worked with the merged branch. It looks like this now:

Git merge A into B and B into A

Is this a problem? Why? Currently, everything seems to work correctly. Should I solve that merge? How can I solve it?

(Later I have to merge everything into "master". I hope there will be no problems.)

Thank you!

schube
  • 652
  • 5
  • 18
  • 1
    No, it’s not a problem. – Ry- Mar 17 '17 at 08:26
  • Its not a problem and you can read here how to fix it if you wish to. http://stackoverflow.com/questions/34519665/how-to-move-head-back-to-a-previous-location-detached-head/34519716#34519716 – CodeWizard Mar 17 '17 at 08:30
  • First of all, when you merged A into B you said "B should have the same contents as B+A". Then when you merged B into A you said "A should have the same contents as A+B". If you did this back-to-back the two branches should now be equal. If you didn't intend this, ie. one or both of the branches should be independent of the other, then you have a problem. If not, then no, you don't have a problem. – Lasse V. Karlsen Mar 17 '17 at 08:32

1 Answers1

7

No, it is not a problem if the result is what you want, meaning both branches are identical now. You first merged the changes of the left branch into the right branch, so that the right branch has everything of the left branch plus its own commits, then you merged the changes of the right branch into the left branch, so that both have the same content now. If you wouldn't have used --no-ff option, then there would actually not have been a second merge commit, but simply the branch pointer of the left branch would have pointed to the same commit as the branch pointer of the right commit, which is the first merge commit.

Vampire
  • 35,631
  • 4
  • 76
  • 102