Break up multiple changes into separate commits with git?

If I have made multiple sets of changes to a large file, is it possible to split those into separate commits using git?


Solution 1:

You want git add --patch (documentation), which will allow you to select which changes to stage.

Solution 2:

Yes, you can -- use git add -i to select which hunks you want to stage for each commit. You can get documentation by running git help add and scrolling to "Interactive Mode".