gitgithubgit-mergegithub-for-windowsgit-status

Git says up to date although changes were made remotely


Using git bash: I worked on my master branch, pushed it and decided I want to implement a new feature. I created a new branch for that. Later I added another feature, creating yet another branch.

I tested everything and it was working, so I decided to merge everything to my master branch. I pushed both new branches to the remote repo.

Now, using my browser github suggested to create pull requests for the new branches, which I did, and then suggested that I can safely merge, as there are no conflicts. So I merged all branches to master.

I thought, that since I did this online, my local branch would not be up to date anymore.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

I couldn't really believe that, so I decided to pull from my remote repo.

$ git pull origin master
remote: Enumerating objects: 2, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/name/repo
 * branch            master     -> FETCH_HEAD
   ID..ID  master     -> origin/master
Updating ID..ID
Fast-forward
 file1 |  67 +++--
 file2     |  25 ++
 file3        | 292 +++++++++++----------
 3 files changed, 221 insertions(+), 163 deletions(-)
 create mode 100644 newfile

Why did git think my local master branch was up to date, when in fact it wasn't?

Disclaimer: I'm not very experienced with git and work soley on my repos.


Solution

  • After the work you did via Github, you would have needed to run git fetch to refresh the information about your remote-tracking branches and see any updates to git status.

    git pull, in simple terms, is just doing git fetch and git merge.

    This SO question is full of great info about this.