Skip to contentSkip to conversation

git commit --cleanup and templates

DISCUSSION Sebastian Schuberth 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

when I recently for the first time used commit templates, I was surprised to see that git by default strips leading empty lines that I deliberately added to the template file when opening the template in the editor. I understand that I could use a different cleanup mode, but in fact I *want* git to clean everything, but only *after* I finished editing the commit message, not already when opening the editor.

Before submitting a patch, I'd like to hear what other people think about this, or whether I'm overseeing something.

Thanks.

Signature · 1 line
Sebastian Schuberth
#1 lore raw
Quoted 10 lines · Sebastian Schuberth

when I recently for the first time used commit templates, I was surprised to see that git by default strips leading empty lines that I deliberately added to the template file when opening the template in the editor. I understand that I could use a different cleanup mode, but in fact I *want* git to clean everything, but only *after* I finished editing the commit message, not already when opening the editor.

Before submitting a patch, I'd like to hear what other people think about this, or whether I'm overseeing something.

Nobody has responded, so I doubt anybody has strong objections (or maybe they just didn't read your message. :) ).

Personally, the behavior you are proposing makes more sense to me, and I don't think you will really be hurting anybody by changing it. You will not affect the final commit message, but only what the user sees in their editor. And if people are really attached to not having extra whitespace in the editor, then they can simply clean up their templates.

So I would suggest working on a patch if it is something you want.

-Peff