1

I am trying to merge two branches into a single new branch, and all three branches have a single parent branch in common.

Two branches "feat1" and "feat2" are isolated and branched off from "dev" branch. Now I want to create a new branch, called "next-release" from "dev", and merge "feat1" and "feat2".

What I did :

  1. checked out to "next-release" and merged "feat1".
  2. then merged "feat2".

At this point, I'm getting "Please enter a commit message to explain why this merge is necessary...".

Am I doing it right?

To explain it better:

  dev
   |
----------------
|       |      |
feat1   feat2  next-release = feat1 + feat2

Any help is appreciated. Thanks.

Azima
  • 3,835
  • 15
  • 49
  • 95
  • You don't have that on a git pull, do you? (as in https://stackoverflow.com/a/36418799/6309) – VonC Feb 27 '18 at 05:39
  • 1
    It is correct that you get asked for a commit message when you end up with a merge commit. It is also correct that you end up being asked only for the second merge as the first merge will be a fast-forward which won't commit anything (unless you force it). So yes, you appear to be doing it right. – Lasse V. Karlsen Feb 27 '18 at 07:13
  • @VonC thank you for making that clear. :) – Azima Feb 27 '18 at 08:02

1 Answers1

1

First, yes, your sequence is correct (provided you did create the integration branch from dev at the point where feat1 and feat2 were created (as it appears to be from your diagram): that way, the merge between feat1 and feat2 benefit from a common ancestor.

Second, the message is, as seen here, a way for your editor called by Git to prompt for a merge message commit: once entered, that will complete the merge.

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