I'm learning Git branches and have somehow turned a small personal project into a forest of branches named `test`, `new-test` and `fix-final`. I know branches are useful for isolating risky changes, but creating one for every spelling correction seems silly. How do you decide what belongs on a separate branch when working alone, and when should a short-lived branch be deleted after merging?
Getting comfortable with version-control branches without creating a branch for every tiny change
- programming-help
- comfortable
- version
- control
58
3 replies
I keep one branch for one piece of work, not one branch for every typo. If I'm just fixing a word or changing a comment, I usually do it on...
I keep one branch for one piece of work, not one branch for every typo. If I'm just fixing a word or changing a comment, I usually do it on the same branch as the related code unless I'm already waiting on review.
Same here. I make a branch when I want a clear checkpoint, like adding a new feature or trying a risky refactor, not when I'm changing a label in the UI.
Delete it after merge if you don't expect to touch it again right away. If the branch was just a short experiment and it's merged cleanly, keeping it around usually just makes the list noisy.
I leave it for a day or two if I'm still testing something in the merged code, then delete it. A branch named `fix-final-final` is usually m...