Being the lone developer on a personal project makes it really easy to do sloppy things. For example, doing undisciplined things with my git repo, like just working in the master branch (I really need to change that to main) and pushing commits directly to it.
It’s much better practice to create a branch for each “issue” and merge that into the master branch (as per the GitHub flow). When it’s just you it’s easy to forget to actually do that, and even easier to not care when you realise, and just merge your changes to local master directly into master origin.
Whenever that happens it always feels a bit.. yuck… so today I’ve implemented some some discipline in the form of branch protection rules. Nothing too fancy, just preventing me, or anyone else, from pushing directly to master without first having a pull request approved. Yes I will be the one doing the approval, but that still means I have to actually create a branch and make the pull request in the first place.
This should mean I stop making a mess of master and the whole thing becomes much cleaner.
by
Tags: