Reasons for not working on the master branch in Git

Mark Williams picture Mark Williams · Apr 19, 2011 · Viewed 14.5k times · Source

So, I'm fairly new to git and I've after a bit of reading around over the last couple of weeks I've read a few people saying that the master branch shouldn't be changed but rather branched from and then merged to.

I'm happy enough to work with branches but was wondering for the reasons behind not working on the master branch?

Answer

Karl Bielefeldt picture Karl Bielefeldt · Apr 19, 2011

Other people have made very good cases for not making changes directly in master, and I agree with them. However, always advocating workflows like this sometimes leads people new to git to believe it is needlessly complex, so I wanted to provide a counterpoint.

If you have a one-person or very small team and your development is highly linear, i.e. you rarely work on more than one thing at a time and each feature is usually completed before starting the next, there really is little to no benefit to not work directly out of master. It is very easy to go back and add a branch at any point should the need arise. I highly recommend being aware of the feature branch workflow, but if you feel in your case it's just adding extra steps without buying you anything, I promise I won't tell the git police.