tidelake tidelake - 1 year ago 77
Git Question

Confused by 'up-to-date' message in git workflow

Why does git say local master is up to date with origin/master when I can pull an update?

[rails-app (dev)]$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[rails-app (master)]$ git pull origin master
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 13 (delta 11), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.
From bitbucket.org:account-name/rails-app
* branch master -> FETCH_HEAD
2f2fcc0..b3e3bed master -> origin/master
Updating 2f2fcc0..b3e3bed
app/assets/stylesheets/application.scss | 7 -------
app/mailers/reminder_mailer.rb | 2 ++
config/routes.rb | 2 --
3 files changed, 2 insertions(+), 9 deletions(-)

Answer Source

Because origin/master is the "last known state" of the remote, not necessarily the current state of the remote. If you did git fetch first and then git status, you would see a message indicating that you are behind origin/master.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download