Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is git branches necessary for a single developer?

Tags:

git

github

I'm a single developer. I use git for my projects.

For every single feature (Ex. Login/register pages), I create a new branch to implement it

Later I merge that branch in my master.

Now I have like 20+ branches and I feel like i'm doing it in the wrong way.

Is git branches necessary for a single developer?

like image 312
PrivateUser Avatar asked Dec 29 '25 10:12

PrivateUser


2 Answers

The main purpose of the branch is that you can leave the master untouched and stable, rather than having part-completed features that may cause issues. You could solve the problem with just one non-master branch for the current in-flight feature - delete all the old ones. You can avoid holding up a release working this way, because you won't say "we can't release because feature X is only half complete".

You can also solve the problem by working directly in master, but key-stoning the feature so it isn't visible to users until it is complete. You need good CI practices to give you the confidence to do this.

like image 190
Fenton Avatar answered Dec 30 '25 23:12

Fenton


Once you have reintegrated your changes in the master you should delete your old branch. You just need to branch out if you absolutely need the specific change to be isolated.

If your project does not have many forks you dont need to keep these change isolate because the master is the only branch you need to migrate your changes.

like image 42
Lynch Avatar answered Dec 30 '25 22:12

Lynch