2013-04-11 186 views
1

我很困惑我的生產服務器爲什麼認爲它比我的主分支早。我使用fabric進行部署,並在github上的主分支上運行服務器上的git pull。我沒有在生產服務器上知道自己的修改,而且我也沒有在生產服務器上進行提交。如何讓git與遠程主分支同步

git status產量:

# On branch master 
    # Your branch is ahead of 'github/master' by 57 commits. 
    # 
    nothing to commit (working directory clean) 

至於我可以告訴大家,什麼是生產服務器上匹配在我的開發環境的主分支。至少該網站的行爲是一樣的,但我覺得很不安。關於如何在github master的同一頁面上獲取生產資源庫的任何想法,並停止給我這個消息?

編輯(2013年4月11日):

只是爲了澄清,當我用布來部署,運行:在服務器上

git pull github master

我上面寫在原問題中的git狀態結果在服務器上。我永遠不會在服務器上進行提交,只能在我的開發環境中進行提交,而我將這些提交給github,然後再將這些提交到服務器。這就是我困惑的原因。我當然不想將任何東西從我的生產服務器推送到github,這與我的工作流程相反。

第2編輯(2013年4月11日):

這裏的fabfile的Git代碼:

def prepare_remote_deployment_area(): 
    """Prepare the production host with updated resources""" 
    with cd(DEPLOYMENT_ROOT): 
     run('git pull github master') 

這是從部署稱爲:

def deploy(): 
    """Deploy an update (committed to GitHub) to production""" 
    check_git_status() 
    check_git_status(on_remote=True) 
    prepare_remote_deployment_area() 
    restart_uwsgi() 
    restart_nginx() 
    restart_celery() 

同樣,這一切似乎工作的意義在於我在開發環境中所做的更改顯示在生產環境中。我只是不明白爲什麼生產庫認爲它遠遠超過github master。

+0

是 - 它是好的 - 你在你的本地主這就需要推入遠程變化。只要做一個'git pull origin master'然後'git fetch --all' – karthikr 2013-04-11 04:59:29

+0

您是否創建了自己的fabfile.py? – catherine 2013-04-11 16:18:29

+0

在第二次編輯中添加了凱瑟琳問題的詳細信息。 – Dave 2013-04-11 20:21:50

回答

0

也許git pull

git pull origin master 

更多信息

NAME 
     git-pull - Fetch from and merge with another repository or a local 
     branch 

DESCRIPTION 
     Incorporates changes from a remote repository into the current 
     branch. In its default mode, git pull is shorthand for git fetch 
     followed by git merge FETCH_HEAD.