Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have Project Part of Two Git Repositories?

Consider the following scenario:

Someone has a project on Github that might be updated once a month, and it has X functionality. I want to take that project and modify it slightly so it no longer functions like X but functions like Y, but I still want to stay up to date with their changes. How do I do this? I'm familiar with merging two projects, but it seems like I need two git repos.

Can I just have the project with two .git directories, one for theirs, one for mine? I don't want to just start a completely new project and not be able to stay up-to-date with their changes, and it's not really practical to make it so their project has the functionality of both X and Y, so it seems best to have merge my project with theirs as a new git repository.

What do you think?

like image 289
Lance Avatar asked Nov 21 '25 08:11

Lance


2 Answers

What I think of is branching. Just create a fork ( using clone ) of "their" project and create a branch for your feature y. Then, over time, you can easily merge the original tree back into your branch. Git is very good at this special task. If you want to learn about it, just visit the according chapter in the git-book.

On the other hand, them being located at github invites you to support the development, as maybe other people may also enjoy having "feature y" at their disposition :-)

like image 53
moritz Avatar answered Nov 23 '25 23:11

moritz


Fork their repository (on github, for example), make a local clone, then add their repository as a remote with git add-remote. Then you can pull from them and push to your own repository.

like image 23
mcv Avatar answered Nov 23 '25 23:11

mcv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!