【问题标题】:Git - Change remote branchGit - 更改远程分支
【发布时间】:2014-04-27 11:18:23
【问题描述】:

我有以下几点:

$ 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.

【问题讨论】:

    标签: git heroku github branch git-remote


    【解决方案1】:

    将本地生产分支的上游分支设置为 origin master。

    git branch --set-upstream production origin/master
    

    【讨论】:

    • 我的远程分支被称为“生产”,所以如果我尝试git branch --set-upstream production production/master,我会得到这个奇怪的结果Branch production set up to track remote branch master from staging.(“staging”是我使用的另一个远程环境)
    猜你喜欢
    • 1970-01-01
    • 2022-01-09
    • 2012-10-22
    • 2014-11-27
    • 2021-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多