This is a bad idea and if this seems necessary you are interacting with very low quality committers. People who don't even bother reading their own commits do not deserve to get their commits merged.
Also, that gitignore doesn't even work. man gitignore:
• An optional prefix "!" which negates the pattern; any
matching file excluded by a previous pattern will become
included again. It is not possible to re-include a file
if a parent directory of that file is excluded. Git
doesn’t list excluded directories for performance
reasons, so any patterns on contained files have no
effect, no matter where they are defined. [...]
This is the email thread I started back on 2016/03/3 to pin down the gitignore behavior that we now have today (there was a regression between git version 2.6.0 and 2.7.0):
Comments
This is a bad idea and if this seems necessary you are interacting with very low quality committers. People who don't even bother reading their own commits do not deserve to get their commits merged.
Also, that gitignore doesn't even work. man gitignore:
It's not terribly far off. This works:
This is how I've been managing my dotfiles for over a decade (https://github.com/cstrahan/dotfiles/blob/master/.gitignore).This is the email thread I started back on 2016/03/3 to pin down the gitignore behavior that we now have today (there was a regression between git version 2.6.0 and 2.7.0):
https://lore.kernel.org/git/1457057516.1962831.539160698.3C8...
(For posterity: the subject line was "Change in .gitignore handling: intended or bug?")