指向多个git存储库的单个目录 [英] Single directory pointing to multiple git repositories

查看:94
本文介绍了指向多个git存储库的单个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在软件供应商公司工作.我的团队需要将代码提交到客户的git存储库,我们在提交代码之前会先进行代码审查,我们将在其中进行所有注释和代码更正.要设置此流程, 我想将父项目目录指向多个git存储库

I am working in software vendor company. My team needs to submit code to client's git repository and we conduct code review prior submitting code in which we will have all the comments and code correction.To setup this flow, I want to point parent project directory to multiple git repositories

如何在osx的同一目录中设置两个git存储库.我正在使用sourcetree作为git工具

How can I set up two git repositories in the same directory on osx. I am using sourcetree as git tool

推荐答案

您可以为单个遥控器设置多个推送URL.

You can set up multiple push URLs to a single remote.

原始是git项目中的默认远程

Origin is default remote in a git project:

git remote -v
origin  git@git.company.es:group1/project.git (fetch)
origin  git@git.company.es:group1/project.git (push)

然后,您可以向遥控器添加更多推入URL.

Then you can add more push url to your remote.

git remote set-url --add --push origin git@git.other.es:test/project.git

现在,您应该显示两个(推送)URL和一个(获取)URL.像这样的东西: git remote -v 原始git@git.company.es:group1/project.git(提取) 原始git@git.company.es:group1/project.git(推送) 来源git @ git @ git.other.es:test/project.git(push)

Now you should show two (push) URLs and one (fetch) URL. Something like this: git remote -v origin git@git.company.es:group1/project.git (fetch) origin git@git.company.es:group1/project.git (push) origin git@git@git.other.es:test/project.git (push)

按此遥控器将同时推送到两个上游.从此遥控器进行取回仍将仅从原始存储库中取回.

Pushing to this remote will push to both upstreams simultaniously. Fetch and pull from this remote will still pull from the original repo only.

您还可以保留原始远程服务器(起源)并创建备用远程服务器,并使用它来推送两个存储库:

Also you can keep the original remote (origin) and create an alternative remote and use it to push both repositories:

git remote add both
git remote set-url --add --push both 
git@git.company.es:group_1/project.git
git remote set-url --add --push both git@git.other.es:test/project.git

您的远程配置将是:

git remote -v
origin  git@git.company.es:group1/project.git (fetch)
origin  git@git.company.es:group1/project.git (push)
both    git@git.company.es:group1/project.git (fetch)
both    git@git.company.es:group1/project.git (push)
both    git@git@git.other.es:test/project.git (push)

现在您可以决定要在不同情况下使用的遥控器.

And now you can decide which remote you want to use in different situations.

这篇关于指向多个git存储库的单个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆