small, focus, logically distinct commits will increase your chance of getting your code integrated into open source projects. It will also help you write code in an incremental way that is much easier to reason about. It makes it easier to:

- incrementally pull your changes

- revert individual parts that might be broken

- git-bisect to binary search through your commits and find exactly what commit introduced a bug

- do code review

- understand what each change does via the commit description

Unfortunately GitHub actively encourages you to not think about commits which is another reason why I despise it and encourage email patch contributions. nostr:note1szzl0tzgghl4252y7q3hgnv4c6f8z46ehkyvz7ntpsel52x5epvqvmnndm

Reply to this note

Please Login to reply.

Discussion

I concur. I usually create a separate branch, and "rebase -i" many times in order to keep changes grouped together into logically consistent units. So if I need to fix something 3 commits ago, I commit that change separately, then "rebase -i", move it down and mark it as "fixup". Sometimes after committing too many things together I mark that branch to the side, make a new branch and checkout files one at a time from that branch to make separate logical commits. It might seem like a lot of extra work, but making the changes readable to other people, and making them easy to revert as logical units, does pay benefits.

💯 I do the same interactive rebasing before I ever push a branch off my laptop

💯

I guess this is why I don't contribute to open source. My brain doesn't work this way.

How does GitHub encourage bad things?