Git Branching – Single or Multiple Branch Strategy

branchinggitproject-management

I am working on this project of mine where I am the only developer. I have chosen git for the version control for the project. Currently, I work from multiple systems and commit to the master branch of my central repository.

I wanted to know if this is a proper strategy or I am missing out of any helpful Git feature. Should I create branches for different systems or for different features of my project? Please advise what is a generally recommended strategy for my use case.

Best Answer

First of all, your current approach seems perfectly valid.

Working from several systems (I understand here several PCs in different places, or eventually different OS compiling the same sources) doesn't change the fact that you still work on the same piece of software. So this should not not be the major influencer of your branching strategy.

However, it could be interesting to create branches for new major features, especially if significant refactoring is required. Branching could then allow you to still maintain the current version while working on the new one, and in case of serious troubles switch back to the working version.

If you work solo on a single system, you could avoid such branching by keeping the changes in the local repository before pushing them to your central repository. But branching would facilitate things especially if implementation of the new features take longer time.

But in your case, when working on several systems, you can't rely on the local repository. So the branching would definitively bring you the benefit to have "work in progress" shared between several systems.

Be careful however not to make your branching strategy too complex, especially if you're working solo on your project.