简体   繁体   中英

Merging branches in GIT - What does this message mean

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 ?

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM