Merging branches in GIT - What does this message mean

218 views Asked by At

In my project I currently have two branches a branch called DEMO and another branch called Master. I am attempting to merge DEMO into Master. The branch Demo has some files that Demo does not have along with some other changes.In order to do that I am using Source Tree to do the merge. After the merge was done. I am assuming it was successful( since I did not get any conflict messages). I attempted to do a commit of the Master branch (with all the merge changes in it). At that point Source Tree tells me there is nothing to commit and on the command prompt I get this

$ git commit -m "Merge Demo into Master"
# On branch master
# Your branch is ahead of 'origin/master' by 17 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

My question is if the merge was successful why does it not let me commit the work. Also what does the message mean ?

2

There are 2 answers

0
Makoto On BEST ANSWER

I'm willing to bet that you've already merged your branches together, and that this was a fast-forward merge. Your master branch is ahead of the origin by however many commits you had on your previous branch; in this case, it's 17.

In a fast-forward merge, there's no merge commit, and so no message is generated. This means you're in a good spot to push these changes to the remote.

If you really wanted to create a merge commit before you merged these branches, then you'd need to be explicit about the type of merge you do.

git merge <branch> --no-ff

This explicitly creates a merge commit, and will open a commit message dialog for you in your editor of choice and allow you to supply a commit message.

0
Don Branson On

When you did the merge, it automatically committed the result. Now you're ready to push your local commits to the remote repository.

Your branch is ahead of 'origin/master' by 17 commits. means you have local commits not yet pushed to the origin.