Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Committing when changing source formatting?

Is it accepted practice to commit even when you're just changing things like whitespace, code formatting, etc.?

like image 938
chrisgoyal Avatar asked Feb 06 '10 19:02

chrisgoyal


1 Answers

Yes. If you need to do whitespace changes, doing them in a separate commit that contains only this kind of cleanup is the best practice. This avoids problems with trying to see what part of a giant diff is actual code changes, and what part is just formatting (cosmetic) changes.

That said, you should try to keep these kind of changes to a minimum, and only do it at all when it is necessary and compatible with whatever coding standards are used in your company / community / project / etc.

like image 73
Jakob Borg Avatar answered Sep 22 '22 21:09

Jakob Borg