Best practices on GitHub repos, to Fork or create a New Branch

Erowlin picture Erowlin · Jul 25, 2014 · Viewed 11.5k times · Source

I'm looking for the best practice, forking vs branching on GitHub. I've read this Forking vs. Branching in GitHub, but it's not relevant.

Our team of 5 people are working on the same repository, and we would like to avoid merging problems, conflicts or regression in the code. The goal is for the 5 persons to work on different parts of the project, often on the same file.

I would like to know if it's worth it to :

  • fork the project, work and create pull requests, so each persons can review the code easily, or
  • create a new branch - work and merge on master when work is done.

Answer

Balthazar picture Balthazar · Jul 30, 2014

To me, the best practice when dealing with a project with more than one developer, is to use gitflow branching model.

First, the master branch will now only be used to keep track of the releases of your app, major, minor or patch versions, following the Semantic Versionning.

The develop branch will be the core of your project, since it will make the bridge between the different features and your releases.

This system helps to reduce the number of merge, just as a simple branching system will do, but add the semantic logic, and the friendly and simple commands that comes with it.

For more info about gitflow you can follow this link.