user310291
user310291

Reputation: 38228

Why git status says I have differences whereas git fetch origin shows nothing?

With git status, I get this message:

On branch master
Your branch and 'origin/master' have diverged, and
have 9 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean

With git fetch -v origin, I get

[up to date]      master     -> origin/master

Aren't the two in contradiction?

Upvotes: 1

Views: 90

Answers (2)

git fetch is telling you that origin/master in your repository and master in the origin repository are the same. git status is telling you that origin/master in your repository and master in your repository have diverged. There's no contradiction, since they're talking about different things.

Upvotes: 1

Acorn
Acorn

Reputation: 26196

There are 3 branches in play here, instead of 2:

  • Your master
  • Your origin/master
  • The remote's master

git status is comparing master and origin/master (both local branches).

git fetch, however, is comparing the remote's master and your local origin/master.

Upvotes: 2

Related Questions