2

I did the following steps:

git checkout master 
git pull origin master
git merge branchB

It did the update:

git merge queryclassintegration

Updating f2318bc..c9b732a
Fast-forward
build/test.sh                   |    5 -
unit-test/test                  | 1110 ------------------------
include/io.hpp                  |   15 ++
3 files changed, 15 insertions(+), 1115 deletions(-)
delete mode 100755 build/test.sh
delete mode 100644 unit-test/test
create mode 100644 include/io.hpp

and when I did this

git push origin master

showed this which I assume it registered the merge:

Total 0 (delta 0), reused 0 (delta 0)
To https://myrposoti@bitbucket.org/xyz/bproject.git
d8818bc..m9b231a  master -> master

But then I checked the repo and the merge hasn't been registered yet (no indication of Merge). And if I do push again:

git push origin master

It says:

Everything up-to-date
user3639557
  • 4,791
  • 6
  • 30
  • 55
  • You may be blocked from directly pushing into the remote branch on BitBucket. Can you check with your admin about this? So the workaround (and what the admin wants you doing) would be to create a pull request on BitBucket. – Tim Biegeleisen Dec 21 '15 at 02:45
  • It's a personal repo, so being blocked is not the reason. – user3639557 Dec 21 '15 at 02:45
  • Force pushing is not the way to go here, and is inappropriate based on what the OP has said so far. – Tim Biegeleisen Dec 21 '15 at 02:48
  • It appears that your fast-forward merge happened successfully. I don't know why it is not reaching BitBucket, but my guess is that you have a configuration problem. – Tim Biegeleisen Dec 21 '15 at 03:05
  • I just did a fresh clone, and it clones fine (has the merged stuff on the master branch). So, the merge was fine but bitbucket is not showing it. Which is annoying. – user3639557 Dec 21 '15 at 03:07
  • 1
    I thought the commit hashes were hex, did git really print `m9b231a` as a commit hash? m is not a hex digit. Can you use `git log` to look at the full commit hashes and make sure hey don't have any non-hex digits in them? – David Grayson Dec 21 '15 at 03:08
  • 1
    We use BitBucket, and I seem to recall that there can be a delay between an operation and when it actually shows the update. Welcome to world of open source. – Tim Biegeleisen Dec 21 '15 at 03:10
  • Are you looking for a merge commit? Fast forward merges don't create merge commits. – Tom Verelst Dec 21 '15 at 11:04
  • @TomVerelst ah didn't know that. But I haven't set any parameter to make the merge fast forward. How did it happen? – user3639557 Dec 22 '15 at 11:16
  • If a fast forward is possible, the default behaviour of Git is to do a fast forward merge. – dunni Dec 22 '15 at 12:25

1 Answers1

1

You’ll notice the phrase “fast-forward” in that merge. Because the commit pointed to by the branch you merged in was directly upstream of the commit you’re on, Git simply moves the pointer forward. To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit’s history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together – this is called a “fast-forward.”

Source: Git Manual - Basic Branching and Merging

If you don't want to fast-forward merge and create a merge commit, you can use the --no-ff option.

$ git merge --no-ff branch

If you don't want merge commits, you can use the fast-forward only option --ff-only. If Git cannot fast-forward merge the branches, it will error out. You can decide then what you want to do.

git merge --ff-only branch

There are more answers explaining fast-forward in the following question: What is the difference between `git merge` and `git merge --no-ff`?

Community
  • 1
  • 1
Tom Verelst
  • 15,324
  • 2
  • 30
  • 40