DEV Community


Posted on

When do I branch in Github flow?

Please mind my so beginner git question.

I've been reading about GitHub flow, I understand I should create a branch for features and bug fixes.

What I'm wondering is do I start creating a feature branch immediately after initializing the project or at what point do I know I need to branch or do I even get it at all??

Discussion (5)

harryammon profile image
Harry Ammon

Immediately after initialising a repository I create a branch called feature/setup. In this branch I create the project structure, create files such as and .gitignore. Once I am happy with how the project is set up I merge this with main and then create another feature/ branch for each new feature I add to the project

alexanderjanke profile image
Alex Janke • Edited

Think of it this way:
You want to implement a new feature. After the 5th commit you realize that all you did wasn't even that smart and you want to start over. With a branch you can just delete that branch and you're good. If you did all your commits on the master-branch, then you'd have to start reverting your commits.. annoying.

I personally create branches for whatever I do as I see no downside in using them.

patarapolw profile image
Pacharapol Withayasakpunt

I do it after first alpha, but it depends on whether you have contributors / team as well, I guess.

yinkakun profile image
Yinka Author