3

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

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

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

git push origin master:mac-master

每次我需要推动?如果不是,那么正确的做法是什么?

4

2 回答 2

6

如果您总是想这样做,请运行

$ git push -u remote master:mac-master

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

$ git push

mastermac-masteron remote

于 2012-07-31T16:40:31.793 回答
5

You can change the branch on the remote that your branch is tracking by:

git branch --set-upstream   branch_name   your_remote/other_branch_name

This way, pushes of branch_name to your_remote will be done to other_branch_name.

于 2012-07-31T16:44:24.767 回答