Smbobeast Smbobeast - 1 month ago 5
Git Question

Developing on top of an existing git repository

Don't have the most experience with git, so I thought I'd ask as I can't find definite answers.

I want to use an existing git repository, as a starting point for my own project, which also needs to be version controlled and tracked as our team repository. However, this existing repository is actively updated by the community, and I would like to have the ability to also merge these updates in when needed.

Basically I need to build on top of the existing Repo A, while committing the team specific project to a different Repo B, while still being able to merge in Repo A's changes into Repo B's codebase.

Would I use submodules?

Or do I just clone Repo A (using it as the master branch) and create a new branch for the team specific code base, so I can merge the two branches together? This method is confusing as I don't know how I would be able to push changes to a different repo from the one I cloned from. Would I need to create a new remote branch to push the company specific code to?

Any help is appreciated.

Thanks

Answer

I would suggest that you use one repository. You can define multiple remotes.

git remote add <your remote name> <remote path>

You can specify your remote on git push

git push <your remote name> <your branch name>

With this method you can fetch the original sources and merge them into your branches and your branches are pushed to another server