Getting comfortable with version-control branches without creating a branch for every tiny change

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?

  • programming-help
  • comfortable
  • version
  • control
58

4 replies · Sort: Best

Best
  1. CS
    charles_5
    4 points

    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...

    43 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 the same branch as the related code unless I'm already waiting on review.

    4
    1. xiao.si
      3 points

      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.

      3
    2. IT
      tagliafierro-i
      4 points

      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.

      4

        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...