简体   繁体   中英

updating branches using git pull

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM