Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I commit cosmetic changes?

There are minor coding style changes that I often want to commit to the source control, but now the change log is full of those changes that do not affect code functionality.

What should I do next time I have to fix minor things like:

  • Remove and sort usings (in .NET, imports in python, includes in c++)
  • Correct indentation, spacing and line breaks
like image 595
Jader Dias Avatar asked Jan 12 '10 13:01

Jader Dias


People also ask

What is a cosmetic change?

adjective. If you describe measures or changes as cosmetic, you mean they improve the appearance of a situation or thing but do not change its basic nature, and you are usually implying that they are inadequate.

What are cosmetic changes in code?

Cosmetic requirements are nothing but the user interface or just the front end appearance of the software. Most of the times it happens that it keeps changing between different releases. This happens especially in the projects where the agile methodology is being followed.


2 Answers

If you are changing the code file, I don't really see why you wouldn't want to commit and share those changes. If you don't you run the risk that someone else will fix them and then collide with yours.

If they aren't changes that other users want in the codebase, perhaps you should ask yourself why you are spending time writing them.

like image 193
Alex Brown Avatar answered Sep 30 '22 16:09

Alex Brown


Do commit them, with the commit comment flagged appropriately to make it easier to ignore when skimming through a list of changes.

Don't commit them in the same operation as a change to functionality. That way, if you do break something, it is easier to narrow down what broke it and is easy to revert just the refactoring if necessary.

like image 40
moonshadow Avatar answered Sep 30 '22 16:09

moonshadow