简体   繁体   中英

How can I get git in sync with remote master branch

I'm confused about why my production server seems to think it is ahead of my master branch. I use fabric to deploy, and it runs a git pull on the server from my master branch on github. I make no changes that I'm aware of on the production server itself, and I certainly do not make commits on the production server.

git status yields:

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

As far as I can tell, what's on the production server matches the master branch on in my dev environment. At least the site acts the same, but I find this disconcerting. Any ideas on how to get the production repository on the same page as github master and stop giving me this message?

Edit (4/11/2013):

Just to clarify, when I use fabric to deploy, it runs:

git pull github master on the server.

My git status results written above in the original question, are on the server. I NEVER make commits on the server, only in my dev environment, which I push to github, which are in turn pulled to the server. That's why I'm confused. I certainly don't want to push anything from my production server to github, that's the opposite direction of my workflow.

2nd Edit (4/11/2013):

here's the fabfile git code:

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

this is called from deploy:

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()

Again, this all seems to work in the sense that the changes I make in my dev environment show up on production. I just don't understand why the production repository thinks it's so far ahead of github master.

Perhaps git pull

git pull origin master

More info

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM