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??

Hi @awesomeyinka Welcome to the community! - Your question is actually an excellent one. The GitHub Flow starts with a main (FKA master) branch. Now, the only special thing about this main branch is that it’s the first branch Git creates when it starts to verge or control a project.

Branching is a core concept in Git, and the entire GitHub flow is based upon it. There’s only one rule: anything in the main branch is always deployable.

Because of this, it’s extremely important that your new branch is created off of main when working on a feature or a fix. Your branch name should be descriptive (e.g., refactor-authentication , user-content-cache-key , make-retina-avatars ), so that others can see what is being worked on.

Here is a link to a very handy visual guide to better understand the GitHub flow.

I hope this helps clear things out a bit!

1 Like