The partial Git commits feature (git add -p) lets you easily commit only selected changes from a file.
Use checkboxes in the diff view of the Commit Changes window to select chunks of code you want to commit.