简体   繁体   English

设置本地git分支在哪里推送和推送

[英]Setting where a local git branch pulls AND pushes

I am working on my forked repo with 2 main branches: 我正在与2个主要分支合作进行我的分叉仓库:

  • master: pulls from main_project/master master:从main_project / master中提取
  • bootstrap: pulls from collaborator/bootstrap 引导程序:从协作者/引导程序中提取
  • The second remote is a fork also contributing to the main project 第二个遥控器是叉子,也为主要项目做出了贡献

I want the above branches to pull from the respective related repos; 我希望上述分支从各自的相关存储库中提取 however, I want them to push to origin/<branch> (master or bootstrap). 但是,我希望他们将其送到origin/<branch> (主服务器或引导服务器)。 I know I can designate a push by git push <remote> <branch> , but I want it to be simpler, if possible. 我知道我可以通过git push <remote> <branch>指定一个push,但是如果可能的话,我希望它更简单。

As a follow-up, would tracking a branch help in anyway? 作为后续措施,无论如何跟踪分支机构都会有所帮助吗? I am not aware of tracking, although I did read about it via similar SO questions. 尽管我确实通过类似的SO问题阅读了有关跟踪的信息,但我并没有意识到跟踪。 How would branch tracking affect my situation? 分支机构跟踪将如何影响我的情况?

You can set a different push url by using the --push argument to git remote set-url . 您可以使用--push参数设置git remote set-url来设置其他push git remote set-url Eg: 例如:

git remote set-url --push git@github.com:someuser/somerepo

For more documentation, see git help remote . 有关更多文档,请参见git help remote

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

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