开发者

git : how to specify a default remote push-to branch?

开发者 https://www.devze.com 2023-01-14 08:49 出处:网络
Suppose I have a tracking branch named \'abc\' which tracks origin/master. When I开发者_运维百科\'m on \'abc\' and do a git push, it pushes \'abc\' to \'abc\'.

Suppose I have a tracking branch named 'abc' which tracks origin/master.

When I开发者_运维百科'm on 'abc' and do a git push, it pushes 'abc' to 'abc'.

How do I specify the remote push branch for it with just a 'git push'?


git branch --set-upstream-to abc origin/master

should be able to specify the remote branch.

Note the -to added to --set-upstream since git1.8.0.

Since Git1.7.0:

"git branch --set-upstream" can be used to update the (surprise!) upstream, i.e. where the branch is supposed to pull and merge from (or rebase onto).


"git push" without a remote branch explicitly named will attempt to push to the site named "origin"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号