簡體   English   中英

如何使git與遠程主分支同步

[英]How can I get git in sync with remote master branch

我對為什么我的生產服務器似乎認為它領先於我的master分支感到困惑。 我使用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)

據我所知,生產服務器上的內容與我的開發環境中的master分支相匹配。 至少該站點的行為相同,但是我發現這一點令人不安。 關於如何將生產存儲庫與github master放在同一頁面上並停止給我此消息的任何想法嗎?

編輯(4/11/2013):

為了澄清一下,當我使用Fabric進行部署時,它會運行:

git pull github master在服務器上。

我在上面原始問題中寫的git狀態結果在服務器上。 我從不在服務器上進行提交,僅在我將其推送到github的開發環境中提交,然后將其拉到服務器。 這就是為什么我很困惑。 我當然不想將任何東西從生產服務器推送到github,那是我工作流程的相反方向。

2nd編輯(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。

也許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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM