从本地主站推送到远程非主站分支

MLi*_*ter 3 git github git-push

在我的本地计算机上,我有一个存储库设置如下

* remote origin
  Fetch URL: git@github.com:me/my_project.git
  Push  URL: git@github.com:me/my_project.git
  HEAD branch: master
  Remote branches:
    mac-master tracked
    master     tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (local out of date)
Run Code Online (Sandbox Code Playgroud)

本地只有master分支,我想总是将我的本地主服务器推送到远程分支.我应该这样做: mac-master

git push origin master:mac-master
Run Code Online (Sandbox Code Playgroud)

每次我需要推?如果没有,这样做的正确方法是什么?

mip*_*adi 6

如果您一直想这样做,请运行

$ git push -u remote master:mac-master
Run Code Online (Sandbox Code Playgroud)

一次.该-u标志将设置选项,以便随后您可以执行以下操作:

$ git push
Run Code Online (Sandbox Code Playgroud)

mastermac-masterremote.


Sha*_*baz 5

您可以通过以下方式更改分支跟踪的远程分支:

git branch --set-upstream   branch_name   your_remote/other_branch_name
Run Code Online (Sandbox Code Playgroud)

通过这种方式,推动中branch_nameyour_remote将做other_branch_name.