使用git pull更新分支

ant*_*009 8 git

git version 1.7.3.5
Run Code Online (Sandbox Code Playgroud)

我有以下分支:

git branch
  image
  master
* video
Run Code Online (Sandbox Code Playgroud)

我在办公室做了一些工作.当我回到家时,我总是更新我家的笔记本.

但是,当我做了一个时,git remote show origin我得到以下内容:

  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)
Run Code Online (Sandbox Code Playgroud)

所以我为所有这些分支做了一个git pull:

git pull origin image
git pull origin master
git pull origin video
Run Code Online (Sandbox Code Playgroud)

当我在视频和图像分支上执行git状态时,我得到:

 nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)

当我在master分支上执行git状态时,我得到:

Your branch is ahead of 'origin/master' by 5 commits.
Run Code Online (Sandbox Code Playgroud)

哪个我不明白以下(fast-forwardable)(local out of date)

但在视频的git状态,它说它是最新的?

如果提前5次提交,我是否需要推动我的主人?

非常感谢任何建议

Kor*_*tor 15

git remote show origin 比较您的本地存储库与远程:

  • fast-forwardable 意味着您可以将本地更改推送到远程分支.
  • local out of date 意味着你的本地分支在远程分支后面,你应该从中拉出来.

git status将您的本地工作目录与当前分支(aka HEAD)的当前提交进行比较.此外,它将您的本地分支与远程分支(origin/master)的(本地!)跟踪副本进行比较,因此Your branch is ahead of 'origin/master' by 5 commits.

要解决git status(仅显示本地数据)和git remote show origin(显示"实时"远程数据)之间的差异,您应该运行git remote update origin它将更新本地跟踪分支.它会将您的本地更新origin/master为远程状态master.之后git status应该给你一些类似的东西 Your branch is behind 'origin/master' by X commits, and can be fast-forwarded.

  • 使用`git pull origin master`让你的本地`master`保持最新状态. (3认同)