Question

I have 2 branches - master and develop While I am on the develop branch, I have commit and pushed a change (Added in a file) and it is successful.

However, when I type git checkout master, followed by git merge develop... Instead of getting the output messages like (I am copying this message from a previous merge that I did), and did a git push:

Updating 325ac4a..51ffb06
Fast-forward
Test_Folder/Images/Img_01.jpg | Bin 0 -> 4224 bytes
2 files changed, 1 insertions(+)
create mode 100644 Test_Folder/Images/Img_01.jpg

I was asked to add in a commit message in the Terminal itself... This is very different from all the previous merging that I have did and it is the first time I have seen it. Though I managed to get pass the commit followed by a git push, am I doing it wrong somehow?

Even so, should the above 'issue' seems correct, is there any way that I can commit the message without going thru the terminal style? (By the way, I tried to do using git gui but apparently I am seeing no files or whatsoever)

Was it helpful?

Solution

It looks like you are getting a true merge this time round and fast-forward merges previously.

Take a peek at git docs for the difference between the two.

PS: It is completely normal to do a true merge. However many collaborated environments tend to disallow them since these are the merges which can actually result in conflicts. A fast-forward merge will never conflict. But again, both are very normal.

Edit: Here's the situation in which a particular kind of merge gets done:

1) Fast-forward merge: This is performed when your master is direct ancestor of the branch you are trying to merge in it.

--*--*--*(master, HEAD)--*--*--*(dev)

In this case, performing the merge means just moving the master reference to dev. The end result would look like:

--*--*--*--*--*(master, dev, HEAD)

2) True merge: This happens when master is not a direct ancestor of the branch you are trying to merge.

--*--*--*--*(master, HEAD)
         \
           --*--*--*(dev)

In this case, master has moved forward from the point on which the dev branch was created. As such, during merging, we will have to include the changes of that new commit(s) on master too. So git will try to create an entirely new commit which inherits from both branches and moves master to it.

-*--*--*--*---------*(master, HEAD)
        \          /
          --*--*--*(dev)

Compare this to ff merge and you will see why they are so named. HEAD denotes the current branch.

I hope I have explained this a bit clearer this time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top