-1

Git seems to be ignoring the results of a fetch and is unwilling to merge them for some reason.

I'm working on two repositories, in order to look after changes from someone who doesn't use git. One was originally my own, and both are synchronized to a bitbucket repo.

I was aiming to feed changes from my own repository up to bitbucket, and have them merged into the other git repo, but git won't have it. From my repository I ran...

$ git push origin master
Password for 'https://cefn@bitbucket.org': 
Counting objects: 16, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.28 KiB, done.
Total 11 (delta 6), reused 0 (delta 0)
To https://cefn@bitbucket.org/cefn/xxx.git
   391de70..fe9ff8c  master -> master

...and then on the other repository I ran...

$ git fetch origin master
Password for 'https://cefn@bitbucket.org': 
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 11 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (11/11), done.
From https://bitbucket.org/cefn/xxx
 * branch            master     -> FETCH_HEAD

However, when I finally run...

$ git merge origin/master 
Already up-to-date.

I have no idea what it's doing. The new changes clearly haven't been merged in. I can see them in bitbucket, they seem to have been downloaded (16 objects) to the local copy of the remote branch on the second repo, but git is deciding they're not there or not relevant for some reason.

cefn
  • 2,895
  • 19
  • 28

1 Answers1

1

I finally worked out that running...

git fetch origin

...was a more general request on the remote server, which downloaded the changes which take the origin/master branch to the latest head. Then...

git merge origin/master 

actually worked. I've no idea why it didn't do this with the original command, 'git fetch origin master' but this worked, finally.

cefn
  • 2,895
  • 19
  • 28
  • 1
    The stackoverflow thread linked below seems relevant and offers a precise answer, but raises a lot of questions - e.g. what is the exact difference between 'git fetch origin master:' and 'git fetch origin master:master' http://stackoverflow.com/questions/11892517/git-fetch-vs-git-fetch-origin-master-have-different-effects-on-tracking-branch – cefn Jun 12 '13 at 18:42