Is there a way to commit only the lines with non-white-space changes?
I have (add-hook 'before-save-hook 'delete-trailing-whitespace)
in my .init.el
and this usually helps me avoid committing trailing white spaces.
However, when I'm working on a project that does not care about those trailing white spaces, the setting makes a huge diff on files I've saved. It might be possible to make the setting per project, but I'm looking for a way to tell Magit to handle it.
I've found a similar question for git proper at https://stackoverflow.com/questions/3515597.
git diff
has a variety of options for white spaces --ignore-space-at-eol
,
--ignore-space-change
, --ignore-all-space
, and --ignore-blank-lines
. It would be nice if we could select those options at magit's popup window.
ws-butler
orws-trim
. You shouldn't be touching whitespace on lines you haven't edited.(add-hook 'before-save-hook 'delete-trailing-whitespace)
is a bad solution.