我在软件供应商公司工作。我的团队需要向客户端的git存储库提交代码,我们在提交代码之前进行代码审查,我们将在其中提供所有注释和代码更正。为了设置此流程,我想将父项目目录指向多个git存储库
如何在osx上的同一目录中设置两个git存储库。我使用sourcetree作为git工具
您可以为单个遥控器设置多个推送URL。
Origin是git项目中的默认远程:
git remote -v
origin [email protected]:group1/project.git (fetch)
origin [email protected]:group1/project.git (push)
然后,您可以向遥控器添加更多推送URL。
git remote set-url --add --push origin [email protected]:test/project.git
现在您应该显示两个(推送)URL和一个(获取)URL。像这样的东西:git remote -v origin [email protected]:group1 / project.git(fetch)origin [email protected]:group1 / project.git(push)origin git @ git @ git.other .es:test / project.git(推送)
推动这个遥控器将同时推向两个上游。从此遥控器获取和拉取仍将仅从原始仓库拉出。
此外,您可以保留原始远程(原始)并创建备用远程并使用它来推送两个存储库:
git remote add both
git remote set-url --add --push both
[email protected]:group_1/project.git
git remote set-url --add --push both [email protected]:test/project.git
您的远程配置将是:
git remote -v
origin [email protected]:group1/project.git (fetch)
origin [email protected]:group1/project.git (push)
both [email protected]:group1/project.git (fetch)
both [email protected]:group1/project.git (push)
both git@[email protected]:test/project.git (push)
现在您可以决定在不同情况下使用哪个遥控器。