←back to thread

361 points mmphosis | 5 comments | | HN request time: 0.426s | source
1. majorbugger ◴[] No.42167110[source]
I don't get the part about the small commits. To me a commit could be massive and that's alright, provided it introduces some major feature, while a fix could a one-liner. It really depends on the situation.
replies(4): >>42167213 #>>42167320 #>>42167335 #>>42167418 #
2. ajmurmann ◴[] No.42167213[source]
It makes debugging so much easier to have small, atomic commits. Of course what's viable depends on what you are doing. I've had great success making changes and rolling them out that aren't actually the full feature yet and some or all parts remain hidden. This also can alleviate the race between two large changes coming in and having to deal with merge conflicts.
3. RangerScience ◴[] No.42167320[source]
Large commits are (IMO) a symptom - lack of a plan, a plan that doesn’t work out, etc. Which is fine! You have to figure it all out somewhere.

One thing you can do to address them is to stash the large commit to the side, then piece by piece pull it into a new branch as a series of smaller commits. This also give a good opportunity to refactor before delivery, now that you know what the code is going to do and how.

4. necovek ◴[] No.42167335[source]
This means that you should look to break up a "major feature" into smaller, iterative steps to delivery.

In general, the biggest hurdle engineers need to overcome is to believe it is possible and then simply start thinking in terms of delivering value with every single branch (hopefully user value, but a refactoring counts too), and what are the small steps that get us there?

The benefits are amazing:

* Changes are likely to be limited to only one "thing", thus making them both lower-risk and easier to review and QA

* With every step shipped to production, you learn if it is providing the benefit you are looking for or if you need to pivot

* You are not developing a feature branch while "main" moves at the same time, and wasting time on keeping up with it

* If the project gets stopped 3 months in, you have still delivered some value, including those in-between refactorings

* Your customers love you since they are seeing improvements regularly

* There is never any high-risk, big "release" where you need to sit around as 24/7 support and wait for bugs to rear their heads

I am happy to give some guidance myself: what is the "major feature" you think can only be done with a single, large change all at once? (I've done huge DB model changes affecting 100Ms of rows with no downtime, merged two "subapps" into one, migrated monoliths to microservices etc, but also built new full-stack complex features with branches with diff size being less than 400 lines for each)

5. tripple6 ◴[] No.42167418[source]
Having a massive major feature done as a single commit is evil. Merging two branches may conclude combining a unit of work, a major feature, a minor feature with the main branch (of course once the topic branch is merged to the upstream, and never vice versa [rebase in git terminology]). This is logically "a big commit" constructed from a concrete amount of small commits. Additionally, having small atomic commits also makes reverting a commit a trivial operation regardless the branch the commit was introduced in. Bisecting a range of small commits also makes finding a bad commit easier.