简体   繁体   English

如何将本地分支推送到远程分支的目录?

[英]How to push a local branch to a directory of remote branch?

For instance: 例如:

I have a local repo branch 'master', and a remote repo branch 'r-master' with a directory 'dir1', I'd like to push 'master' to 'r-master/dir1' and making 'master' to keep track of 'r-master/dir1', is that possible? 我有一个本地repo分支“ master”和一个远程repo分支“ r-master”,其目录为“ dir1”,我想将“ master”推送到“ r-master / dir1”,并将“ master”推送到跟踪“ r-master / dir1”,这可能吗?

Branches and directories are two separate concepts in Git (as oppose to SVN where directories represents branches or tag: See " Git - Store branches in separate local directories "). 分支和目录是Git中两个独立的概念(与SVN相对,其中目录代表分支或标记:请参阅“ Git-将分支存储在单独的本地目录中 ”)。

So you can push master to r-master , but not to r-master/dir1 因此,您可以将master推送到r-master ,但不能推送到r-master/dir1

git push -u origin master:r-master

(with -u or --set-upstream if you need tracking: see (如果需要跟踪,请使用-u--set-upstream :请参阅

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM