Partial Commits in WebStorm
How to enable partial commits with WebStorm
2 min read
2 min read
When interacting with Git, the command line is my goto place. I have a couple of aliases set up and installed git-extras. That makes it a pretty powerful workflow.
Generally, I think they should be avoided. Sometimes though, if you have lots of changes, even covering different responsibilities, it might be worthwile to split them up. That’s when partial commits come in handy. They allow you to only add certain lines of a file into the commit, rather than the entire file.
Webstorm has a commit dialog which is handy for inspecting the changes. If you open up the dialog you see something like this:
The dialog shows you the differences, but there’s no way to just include some of the lines. To configure that you have to enable the “Highlight modified lines in gutter” option.
This should open the Webstorm preferences dialog. Make sure you have the setting enabled there:
Once that’s done, re-open the commit dialog. You should now be able to click the gutter and add single lines.