Search code examples
githubversionbranchrepo

Forking two branches on GitHub


I contribute to the DotSpatial repo and have forked it here. The repo has gone from v2 to v3 (both based on .NET Framework) and v4 based on .NET Core. My plan is to continue the v3 line for my work projects (and those who wish to use my fork). But additionally I want to contribute to the v4 line.

Since the v3 is now discontinued I will probably not make any pull requests on that branch. On the other hand, I will be making PRs to the current v4.

GitHub allows you to fork the main repo only once, so how can I fork two separate branches?


Solution

  • Forking is a Github specific method which is only useful if you want to keep the realtionship to, or make PRs against the parent repository.

    There's nothing stopping you cloning a repository and then committing that to Github - you just have to manually reconcile changes/make PRs since Github doesn't see it as a fork.

    I would fork the repo in Github and use that for v4, since you are likely to want to use the Forking functionality in making PRs etc.

    I would then clone the repo again (locally) under a different name, e.g. DotSpatialv3 and then create/push that to Github as a separate repo.