764 B
764 B
mechanicaldiff
mechanicaldiff lets you filter down a diff to only the parts that make a specific mechanical change, so you can commit those changes separately.
Usage: git diff | mechanicaldiff <pattern> <replacement>
It differs from grepdiff in that it doesn’t just search for the lines that contain the given pattern, but also checks that the only change in that line is that pattern was replaced with the given replacement.
It differs from simply replacing pattern with replacement in the entire repository in that it filters down an existing diff, which means that the resulting diff doesn’t make the mechanical change everywhere, but only in the lines that your original diff also made it.