I'm trying to split changes into several commits, but I'm facing an issue when manually editing a hunk.
Original hunk:
@@ -116,8 +116,8 @@
context
context
- remove 1
- remove 2
- remove 3
+ add 1
+ add 2
+ add 3
context
context
context
I want only the change that happened to 'remove 1' and 'remove 2' to be staged. In other words, I need 'remove 3' to be excluded from the commit.
I tried this:
@@ -116,4 +116,4 @@
context
context
- remove 1
- remove 2
+ add 1
+ add 2
But it keeps outputting patch doesn't apply. I only removed the last context lines and 'remove 3' and 'add 3' lines. I edited the hunk range and subtracted the 4 excluded lines (3 are context 1 are changes, 1 removed and 1 added)
I used 2 different editors, 'nano' and 'sublime text' and both have the same result. I made sure there are no empty lines that aren't commented out.
What am I doing wrong?