EGit: Merging two branches into a new one

3.3k Views Asked by At

I am facing a problem with EGit. I am very newbie with Git and I'm still missing some aspects of it.

Context:

I have 2 branches, master and test on a Git repository. On Eclipse, I import a Git project with those two branches

Goal:

I would like to create a third branch (called MergeTestMaster) where I merge master and test

What I've done:

I've successfully created a branch and did the merge. I just have a problem when commiting (and not pushing) the merge into my local repository I get this result:

enter image description here

I just would like to have a simple branch created (just like the grey one) but instead it is merging master with test in MergeTestMaster.

Questions:

1) Will it be different if I push my changes on the server ? I am still working on a local repository

2) Am I missing something with the way I'm using origin/ // remote repositories ?

I checked out my MergeTestMaster branch in order to do some local work on it and then be able to push my changes to the server

3) Am I completely lost ?

Edit:

I also have this message from EGit saying that I am ahead of 43 commits, is that normal after such an operation ?

enter image description here

1

There are 1 best solutions below

7
On BEST ANSWER

I've successfully created a branch and did the merge.

Yes, that is what you see in the version history view: the two following branches have been merged:

  • master (fb8dea0)
  • origin/test (44617f4)

The merge commit (1fb44e8) is referenced by the local branch MergeTestMaster.

Once you push that branch, origin/MergeTestMaster will reference the same commit as MergeTestMaster.