I hope you're familiar with the benefits of small commits.
As a general rule, you should try to split your changes into small logical steps, and commit each of them. They should be consistent, working independently of any later commits, pass the test suite, etc. - gitworkflows
If you are not used to writing small pieces of code and committing 'em often, you still have the option of patching 'em later with
git add -p.
This command will open an interactive mode where you can review each change you've made and then select just what you want to add to the staging area for committing.
You can watch a very good explanation about it on John Kary's post.