Git - 更改远程分支

时间:2014-03-20 14:24:46

标签: git heroku github branch git-remote

我有以下内容:

$ git remote show production
  Fetching repository, done.
  ...
  Local branches configured for 'git pull':
    master     merges with remote master
    production merges with remote production
  Local refs configured for 'git push':
    master     pushes to master     (up to date)
    production pushes to production (up to date)

但我需要以下内容将我的本地分支production推送到我的远程分支master。我怎么能改变它?

$ git remote show production
  Fetching repository, done.
  ...
  Local branches configured for 'git pull':
    production merges with remote master
  Local refs configured for 'git push':
    production pushes to master (up to date)

修改

如果我尝试

git branch --set-upstream production production/master

我有这个奇怪的结果(“staging”是我使用的另一个远程环境):

Branch production set up to track remote branch master from staging.

1 个答案:

答案 0 :(得分:1)

将本地生产分支的上游分支设置为原始主分支。

git branch --set-upstream production origin/master