There's a couple of issues.
First, don't do changes to the code because you're bored and doesn't have enough real tasks. If this is the case, go talk to your project manager and get some real tasks assigned to you, something with value.
In other words, don't go changing the code for the sake of the change. Always add some value to the code in the process.
Now, if those changes are contributing to making the code easier to handle, by you, and others, then do them. Things like ensuring naming standards are followed, refactor crufty code, etc. But get a task for it, so that your project manager can say "Yes, this is good, spend 2 hours on this and get back to me."
Commit the changes when you're done with them. Don't lop them together with whatever real task you finished just before them, or the next one, it will make merging bugfixes between branches, code reviews, and just general code browsing, hard to follow.
"Ok, so you fixed bug 7711, and also changed about 100 other files. Nice, so what is actually the bugfix here?"