posts: git-basics: add small commits praises

This commit is contained in:
Bruno BELANYI 2020-12-07 18:34:48 +01:00
parent 2ce60ab160
commit c13775266c

View file

@ -294,22 +294,23 @@ section, which I think needs to be said.
### The importance of small commits ### The importance of small commits
* Small commits You might have noticed that people keep saying that commits should be kept
* Why they're useful **atomic**. What does that mean and why should it matter?
* Blame
* Revert
* Review & scope
* `git add -p`
* Stubborn rebase Keeping commits atomic means that you should strive to commit your changes in
* Example from `42sh` the smallest unit of work possible. Instead of making one commit named *WIP: add
* `git rerere` stuff* at the end of the day, you should instead try to cut your work up into
small units: `add tests for frobulator`, `account for foo in bar processing`,
etc...
* Splitting a file with `blame` history This way of working has multiple things going for it once you start taking
* Give attribution to `Old New Thing` advantage of `git`'s power: you can more easily reason about a line of code by
using `blame`, you can more easily squash bugs using `revert`, you can more
easily review the changes in an MR and keep its scope narrow.
* Binary search for a regression One very useful command you can add to your tool belt is `git add -p`, which
* `bissect` prompts you interactively for each patch in your working directory : you can
easily choose which parts of your changes should end up in the same commit.
## Going further ## Going further