简体   繁体   English

在 git 中同步 2 个存储库

[英]Synchronise 2 repositories in git

I have my main project hosted in GitHub.我的主要项目托管在 GitHub 中。 Everything is good and works.一切都很好,工作正常。

Now I'm trying to create a Solaris port.现在我正在尝试创建一个 Solaris 端口。 I make myself an OpenSolaris VM installed Solaris Studio as compiler/IDE and built.我让自己成为一个安装了 Solaris Studio 作为编译器/IDE 并构建的 OpenSolaris VM。

Everything works fine.一切正常。

Now what I'm thinking is that since Solaris Studio is completely different IDE/compiler from MSVC/Anjuta/Xcode, I should create a different repository (NOT A FORK) and push Solaris stuff there.现在我在想,由于 Solaris Studio 是与 MSVC/Anjuta/Xcode 完全不同的 IDE/编译器,我应该创建一个不同的存储库(不是叉子)并将 Solaris 的东西推送到那里。

The only problem is - code synchronization.唯一的问题是——代码同步。

If I make the change in my main repository and push it to remote, I want my second repository to be updated as well with the changes to the *.cpp/.h files.如果我在主存储库中进行更改并将其推送到远程,我希望我的第二个存储库也随着对 *.cpp/.h 文件的更改而更新。

Is there exist some kind of hook to do that?是否存在某种钩子来做到这一点?

Or maybe I'm better off with creating a fork?或者也许我最好创建一个叉子? But then changes to the build system will be overwritten.但是随后对构建系统的更改将被覆盖。

Please advise.请指教。

This is the current structure for the main project:这是主项目的当前结构:

Project folder -> main app folder (*.cpp, *.h, *.sln, Makefile.am/Makefile.in, xcodeproj folder)
                     |
                     ----> library 1 folder (*.cpp, *.h, *.sln, Makefile.am/Makefile.in, xcodeproj folder)

Or maybe I'm better off with creating a fork?或者也许我最好创建一个叉子? But then changes to the build system will be overwritten.但是随后对构建系统的更改将被覆盖。

I wouldn't even bother with a fork.我什至懒得用叉子。

I would just make sure the build system is isolated in its own folder, which allows you to have in one repository two build configuration folders:我只想确保构建系统在其自己的文件夹中是隔离的,这允许您在一个存储库中拥有两个构建配置文件夹:

  • one for a default environment一种用于默认环境
  • one dedicated to a Solaris environment一个专用于 Solaris 环境

That way, you can go on contributing to the code, from either one of those environments, without having to deal with any synchronization issue.这样,您可以继续从这些环境中的任何一个环境中为代码做出贡献,而无需处理任何同步问题。

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

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