【问题标题】:how to push to develop branch not master?如何推送开发分支不掌握?
【发布时间】:2021-01-08 12:50:06
【问题描述】:

每当我尝试使用以下命令推送拉取请求时 将创建的将始终针对 master 分支

git push origin my_sample_branch

我已经尝试过设置我的上游

git push --set-upstream origin develop

但我仍然推送到 master 分支。怎么来的?

【问题讨论】:

  • 试试git push origin yourlocalbranch:develop

标签: git github repository


【解决方案1】:

试试这个命令语法

git push <remote> <local_branch>:<remote_branch_name>

在你的例子中:

git push origin my_sample_branch:develop

【讨论】:

    【解决方案2】:

    执行以下命令:
    1.先切换分支
    git switch my_sample_branch
    2.设置上游分支
    git branch -u origin/develop
    3.直接推送,会自动推送到上游分支
    git push

    顺便可以通过命令git branch -vv查看上游分支

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-09
      • 2016-05-13
      • 1970-01-01
      • 1970-01-01
      • 2015-10-27
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多