views:

71

answers:

2

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?

+3  A: 

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.

mcv
+5  A: 

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 :-)

moritz
+1 - github has a fork functionality that makes it super easy to get started from another project, and then keep up to date with it.
gahooa