Reputation: 17678
Is the message a bit mis-leading?
When checkout a branch (eg., b535
), git does it and says "Your branch is up-to-date with 'origin/b535'." That sounds like what I have in my local branch b535
is up-to-date.
$ git checkout b535
Previous HEAD position was 8aa0145... master - resyns
Switched to branch 'b535'
Your branch is up-to-date with 'origin/b535'.
But actually it's not. When doing a git pull
, it found updates from remote and updating local branch.
$ git pull origin b535
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 39 (delta 31), reused 0 (delta 0)
Unpacking objects: 100% (39/39), done.
...
Upvotes: 6
Views: 631
Reputation: 25413
This is because Git can only know about what it has downloaded. Your local copy of origin/b535
may or may not be up-to-date with your origin
remote.
You need to manually git fetch
to ensure your origin branches are in sync with your Git server...Git won't do that for you automatically with the status
command.
For an up-to-date status command you could define an alias like this:
[alias]
rstatus = "!git fetch && git status"
Upvotes: 3
Reputation: 19035
Well, your branch is up to date with the last known position of origin/b535. If you want git status
to give you more accurate info without having to do a git pull
, do a git fetch
instead. This will update origin/b535, without changing your local b535.
Upvotes: 10