Search code examples
gitmergegit-branchpull-requestbeta

Best way to add new features to a project with GitHub


I have recently launched my first GitHub open source project. Now I would like to add some new features to this project in a beta branch before merging with the master.

But what is the most efficient way of going about this?

A. Is it better to commit all the new features straight into the beta branch and then create a pull request to merge the beta branch with the master.

B. Or should I create a branch for each individual feature and create a pull request to merge those with the beta branch?

A: 
commit →↓ 
commit → beta → master
commit →↑
B: 
commit → feature1 →↓
commit → feature2 → beta → master
commit → feature3 →↑

Solution

  • In my job we prefer branch per feature. It is not about efficiency, but rather about coworking - it is easier to inspect smaller branches and pull requests when I review work of my coworkers.

    Also, better granularity - you know that on branch X you have feature X and you can easily manage such branches.

    When working alone, I do not bother about such granularity - once I finish working on batch of things, I merge. So I create longer lived branches and once I am done, I merge it - I do not review my changes in code review, so this workflow is more suitable for me.