2013-04-11 73 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.