4 ms·
Switching the diff algorithm to histogram is really useful when staging things selectively (via 'git add -p', Magit status buffer, etc.). For example, if we've
by chriswarbo 5y ago
Switching the diff algorithm to histogram is really useful when staging things selectively (via 'git add -p', Magit status buffer, etc.).
For example, if we've inserted ABC and removed XYZ, we might want to put those in separate commits: insert ABC above XYZ, then remove XYZ. If the diff gets them the wrong way round (inserting ABC below XYZ), then we have to manually edit the patch.
This is unavoidable in general, but fiddling with the options can reduce its occurrence. In particular, the default algorithm often spots exact matches like lines only containing '{', then comes up with really convoluted diffs in order to keep those braces matched up (often this will delete entire functions and add them all back!).
- avgcorrection 5y agoThank you. I use interactive staging all the time with Magit so this might make a difference for my workflow.