git version 1.7.3.5
I have the following branches:
git branch
image
master
* video
I did some work at the office. And when I came home I always update on my home's notebook.
However, when I did a git remote show origin
I get the following:
Local refs configured for 'git push':
image pushes to image (up to date)
master pushes to master (fast-forwardable)
video pushes to video (local out of date)
So I did a git pull for all of these branches:
git pull origin image
git pull origin master
git pull origin video
When I do a git status on the video and image branch I get:
nothing to commit (working directory clean)
When I do a git status on the master branch I get:
Your branch is ahead of 'origin/master' by 5 commits.
Which I don't understand the following (fast-forwardable)
and (local out of date)
?
But in the git status for video it saids its up to date?
Do I need to push my master if it is ahead by 5 commits?
Many thanks for any suggestions
git pull is a Git command used to update the local version of a repository from a remote. It is one of the four commands that prompts network interaction by Git. By default, git pull does two things. Updates the remote tracking branches for all other branches.
You can do a git fetch at any time to update your remote-tracking branches under refs/remotes/<remote>/ . This command does not change any of your own local branches under refs/heads , and is safe to do without changing your working copy.
git pull fetches updates for all local branches, which track remote branches, and then merges the current branch.
git remote show origin
compares your local repository with the remote:
fast-forwardable
means you can push your local changes to the remote branch.local out of date
means your local branch is behind the remote branch and you should pull from it.git status
compares your local working directory with the current commit of the current branch (aka HEAD
). Additionally it compares your local branch with the (local!) tracking copy of the remote branch (origin/master
), hence the Your branch is ahead of 'origin/master' by 5 commits.
To solve the divergence between git status
(which shows only local data) and git remote show origin
(which shows "live" remote data) you should run git remote update origin
which will update your local tracking branches. It will update your local origin/master
to the state of the remote's master
. After that git status
should give you something like
Your branch is behind 'origin/master' by X commits, and can be fast-forwarded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With