我很困惑为什么我的生产服务器似乎认为它超前于我的主分支。我使用fabric进行部署,它在github上的master分支上运行服务器上的git pull。我在生产服务器本身上没有做任何改变,我当然不会在生产服务器上进行提交。
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日):
只是澄清一下,当我使用fabric进行部署时,它会运行:
git pull github master
在服务器上。
我在上面原始问题中写的git状态结果在服务器上。我从不在服务器上提交,只在我的开发环境中,我推送到github,然后将其拉到服务器。这就是为什么我很困惑。我当然不想把任何东西从我的生产服务器推送到github,这与我工作流程的方向相反。
2nd Edit(4/11/2013):
这是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 :(得分: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.