29

I have a game project that will have two versions:

  1. A simple version of the game, the core.
  2. An advanced version of the game.

I have the 1st version in my public repository, and only I will be working on it. As for the 2nd version, two friends of mine and I will work on it. The crucial part is that I want the two versions to stay in my repository.

I thought I might use branches for this, but considering this question and its answer, it's not good practice to do so in terms of versioning. As far as I've found out, forking your own repository is not possible.

What are my options here? How can I keep both versions in my repository?

3 Answers3

15

To me it seems that you need two Repositories not two Branches. A branch is a mechanism to handle the changes within a single repository in order to eventually merge them with the rest of code.

If you really want to keep both versions of a Similar code-base in the same repository, then your only option is to go for a Branch, however as mentioned earlier, the main purpose of a branch is to separate some specific commits in a way that they don't conflict with the rest of code during the development period, and merge them when they are ready to go.

There are situations that a repository has two slightly different branches -- e.g. 32-bit and 64-bit versions of the same source-code, however I'd still recommend you to go for separated repositories, if that's an option.

Mahdi
  • 2,003
10

The answer to the question "should I clone or fork" is exactly the same as the answer to this question "do I want my own personal version of this project?" yes = fork, no = clone the repository.

In git, branch is a light weight thing that is often temporary and may be deleted. A fork (on github) is a new project that is based on a previous project. You clone a repository to do work on it as a team member.

Many public projects have you fork the project to keep the working changes out of the main project.

For phase 2, fork the project then clone it to your working computer and have your friends do the same.

DwB
  • 672
3

What it really sounds like you want is a submodule. If you create the first repo (your private simple repo) and then add it as a submodule to the advanced version repo, then you should be able to track and pull changes to the submodule in the advanced repo as you develop the private simple repo.