3

I am "following" a public project (e.g., opencv): that is I cloneed it locally to my environment, and I am using it as a component of a larger project I am privately researching.

I would like to have my private version control (git) monitoring both my private code as well as changes I make to the public project (opencv).
Additionally, I would like to be able to keep the public project up-to-date according to its public version.

That is, I have a local project that has two gits controlling it: both the public git (from which I still want to be able to get occasional updates) and my local git (to which I commit all my changes, that I won't be committing to the public git).

How can I achieve this "dual git" repository?

Shai
  • 111,146
  • 38
  • 238
  • 371

1 Answers1

3

I am using it as a component of a larger project I am privately researching

If your larger project is itself a git repo (with a private upstream repo), you can add Itseez/opencv as a submodule.
Or rather, you would add a fork of that repo as a submodule.

That way, you can keep your private repo private, while keeping a link to your fork in that same repo, and recording possible opencv modifications (or updating opencv with new commits from the original repo).

The parent private repo records a gitlink, a special entry in the index, which represents the state of the opencv submodule at a given time: if you do any new commit in the opencv submodule, you need to push them but also to add and commit the new SHA1 of that repo in your parent repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • wow! I'm fairly inexperienced in git, it will take me a while to process this answer. Thank you very much! – Shai Feb 26 '15 at 13:16