DEV Community

Discussion on: How do you use git when working solo?

Collapse
 
matthewpersico profile image
Matthew O. Persico • Edited

The same way that I work in a team; I create a new worktree and branch for each change I want to make, work through it, PR it, merge it. In this way, if I have to drop the idea for a bit and then get hit with a bug, I can wt/br/PR the bug and don't have to worry about getting that other idea OFF the main before applying the fix, and putting it back after.

Also, I keep my dotfiles and utilities in a git repo. When I clone that down to a new machine, I immediately create a new branch with that hostname. In that way I can make changes on whatever machine I need them and PR/sync all the branches before pulling on each machine.

Branch discipline is best when it becomes second nature; the more repetitions, the better. Why would I keep doing two different things when I can do the same thing in all situations? Easier on the mental dispatch that way.