Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Your "fork" is nothing else than a branch which will be never re-merged into the main trunk. I guess the main trunk devs don't know about your branch and will never pay any attention to the the changes you made to the original code base. So if you change the original code at a place which will be often changed in the future by the main trunk devs, you have a high risk of 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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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