There is an open source project that I'd like to fork for various reasons. The upstream project uses SVN for source code management, but they maintain a read-only Git mirror on GitHub.

I want to take the project on Github and fork it on to Gitlab. One of the most important aspects that I want to be able to do is to merge upstream patches into my fork, but I'm unsure of the best way to go about that? Should I have the master branch track the head branch of the SVN repository and then do all of my development work in a Git branch?

The license the upstream project uses doesn't require changes to be committed back to the main project, but I'd like to keep that option open if possible since I think my changes might appeal to some people in the future once I've tested them on my fork.

I'm just slightly confused about the best way to make sure that I can apply upstream patches to my fork and to make sure that I can merge my changes back to the original project as well if that ever became an option.

2 Answers 2


I would use a separate branch that mirrors exactly the head branch of the SVN repository, besides a master branch that contains the latest release of your fork and any other branches (feature, release, etc.) that are indicated by your preferred branching strategy.

When there is an update from the upstream project, you initially put that in the "upstream" branch, which you then can merge into your main development branch and any active feature branches as needed.

When you want to contribute back, you can make a difference between the "upstream" branch and your main development or master branches to determine what you have added to the project.

  • Thank you for the answer. It was really helpful.
    – Cromulent
    Commented Nov 23, 2018 at 7:47

Part of the git suite are (somewhat hard to use, that's SVN for you) is git svn, that allows bidirectional communication with an SVN repository. You could use that for your work, or just clone the readonly repository and contribute patches (git format-patch is your friend) upstream. Just make sure you develop on a separate branch, which you keep up to date with upstream (git pull -r, rebase the branch on upstream). Be careful, rebasing creates versions that never existed, you'd have to check this doesn't introduce problems (in the end result, in intermediary steps).

Your Answer

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

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