2011-01-30 98 views
8
git version 1.7.3.5 

我有以下分支:更新分支使用Git拉

git branch 
    image 
    master 
* video 

我做在辦公室做一些工作。當我回到家時,我總是在我家的筆記本上更新。

然而,當我做了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) 

所以我做了一個混帳拉所有這些分支:

git pull origin image 
git pull origin master 
git pull origin video 

當我做了一個git狀態我得到的視頻和圖像分支:

nothing to commit (working directory clean) 

當我在主分支上執行git status時,我得到:

Your branch is ahead of 'origin/master' by 5 commits. 

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

但在視頻的git狀態它說它是最新的?

我需要推動我的主人,如果它提前5提交?

的任何建議

+2

運行`git日誌--stat --pretty =格式爲: '%中房%H%CRESET - %S%Cgreen(%CR)%CRESET' --abbrev提交--date = relative origin/master..master`來獲得關於差異的印象。 `(快速轉發)`意味着推送是安全的:分支具有相同的提交,除了一個分支(在你的情況下是`local`)在頂部有一些額外的提交。 – jfs 2011-01-30 16:53:00

回答

14

git remote show origin非常感謝你的本地庫與遠程相比較:

  • fast-forwardable意味着你可以把你的本地修改到遠程分支。
  • local out of date表示您的本地分支位於遠程分支後面,您應該從中取出分支。

git status將您的本地工作目錄與當前分支的當前提交進行比較(又名HEAD)。此外,它的本地分支遠程分支(origin/master)的(地方!)跟蹤副本進行比較,因此Your branch is ahead of 'origin/master' by 5 commits.

爲了解決和git remote show origingit status之間的差異(其中僅顯示本地數據)(它表示「活」遠程數據),您應該運行git remote update origin這將更新您的本地跟蹤分支。它會將您的本地origin/master更新爲遠程的master的狀態。之後git status應該給你類似 Your branch is behind 'origin/master' by X commits, and can be fast-forwarded.

+0

如果我得到'你的分支通過X提交落後於'origin/master',並且可以被快速轉發。'那麼該怎麼做?提前致謝。 – MikeSchinkel 2013-04-22 02:00:50