【发布时间】:2015-05-20 16:44:29
【问题描述】:
我有一个分支,它从一个遥控器拉出并推送到另一个遥控器,U 使用 git branch --set-upstream-to=xxxx xxxx 设置拉取 repo 和 git config remote.origin.pushurl user@user.com:repo.git 设置推送 repo。
虽然拉取来自源代码库上的master 分支,但push 转到目标代码库上的upstream 分支。
当我切换到分支并执行git push 时,我会收到通常的--global push.default 消息:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
有没有办法为特定分支指定它应该推送到远程的哪个分支,而不是 push.default 值,并且对于拉取也是如此?
【问题讨论】:
-
你的意思是推送到不同仓库的同名分支吗?
-
@AndrewC No. 这个想法是推送到任何与分支名称不同的任意命名的分支
-
答案不就是这样吗?
标签: git git-push git-pull git-refspec