4

There is an open source project that I want to fork for my own reasons. It currently has a Git mirror of its main SVN repository which I can use.

What are the best techniques for forking a project whilst still maintaining the ability to merge future changes from the original project into your own forked repository using Git?

Please note I will not be using Github at all for development so using any features from that is out of the question. The project will be hosted on a private VPS.

2 Answers 2

6

Your fork is simply a branch which will be never re-merged into the main trunk. I guess the maintainers of the project don't know about your branch and will never pay any attention to the changes you made to the original code base. So if you change parts of the original code where the maintainers apply also apply changes in the future, expect getting merge collisions. This may be acceptable or not, depending of the frequency of "pulls" from the original code base, and the nature and size of your changes.

Best approach to deal with this is IMHO to keep those changes as small as possible - for example, put most of your code into different files. This will make the chances of merge collisions smaller whenever you "pull" future changes into your branch.

4

Keeping the original project in a branch called upstream or vendor (which I prefer) helps to separate your changes from the changes to the original. I also write the reasons for the fork to the README.md, or even create FORK.md for that reason. Storing that information especially helps if the changes compared to the original are small (and won't get integrated upstream).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.