I have a file that I've been working on and then realized that I had a mistake in it a few lines above where I've been working. I quickly fixed the mistake and want to commit it before I commit the rest of my work. Great, this is where git add --patch comes in!
Except, I'm being presented with only one hunk incorporating both changes. Is it possible to manually tell git that I want two hunks?
git gui
will allow you to commit single lines, even if they are surrounded by other modified lines you do not want to commit.In addition to 'y' and 'n', one of the answers you can give when it asks you about a hunk is 's', for 'split this hunk in to smaller hunks'. The full list: