Git - How can I use a specific remote branch as the upstream source for a
repository?
Perhaps I'm thinking of a bad workflow, but here we go. I have a project
that I would like to use as the base for other projects, since they all
keep the same structure and share common classes. Such base project is
stored in its own Git repository (let's call it MyBaseRepo), where two
branches exist:
master, containing a very stripped down version of the project.
mybranch, containing everything included in master, plus more specific
classes.
What I would like to do is the following:
Create a new project, e.g. MyNewProject, cloning one of the two branches
from MyBaseRepo.
Create a new MyNewProjectRepo Git repository as the origin for the new
project.
Push/pull all changes related to the implementation of MyNewProject to
MyNewProjectRepo.
When MyBaseRepo gets updated, fetch the changes from the appropriate branch.
In short, I would like to put in place some sort of "repository
inheritance", so that when base classes change, the child project can get
the updates.
So far I can almost do the above by pulling MyBaseRepo when needed and
then merging the appropriate MyBaseRepo/branch with MyNewProject master
(or whatever MyNewProject branch). Is this the proper way of doing it, or
am I making my life more complicated than it should be? Thanks in advance
for the answers.
No comments:
Post a Comment