Reputation: 556
I have this hunk, and I'd like to edit it so that the changes to uuid
are ignored.
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -43,4 +44,7 @@
"date-fns": "^2.23.0",
- "uuid": "^8.3.2"
+ "imask": "^6.1.0",
+ "uuid": "^8.3.2",
+ "validator": "^13.6.0",
+ "vest": "^3.2.5"
}
}
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
My idea so far is to do the following which would mean the hunk header doesn't need to change (right?).
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -43,4 +44,7 @@
"date-fns": "^2.23.0",
"uuid": "^8.3.2"
+ "imask": "^6.1.0",
+ "validator": "^13.6.0",
+ "vest": "^3.2.5"
}
}
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
But still, after saving changes and quitting I get the following:
error: patch failed: package.json:43
error: package.json: patch does not apply
At this point, I'm confused and I'm not sure what to try. At first I thought it was the missing space because my VIM configuration replaces it with tabs, but manually adding the space doesn't fix it either (in the -
line).
My only guess so far is that it's a problem with the header, but it should line up correctly right? I'm still adding 7
lines in both cases and the 4
stays the same.
I've reviewed similar questions but haven't found something tackling such problem.
I could try and use a GUI, but I'd like to avoid it if possible.
Any ideas? I'd appreciate it.
Upvotes: 4
Views: 1147
Reputation: 51780
It seems you fell on the same issue as this other user : if you split a hunk in git add -p
, there is a bug that prevents applying "edit manually" a sub hunk.
The workaround is simple : put aside your current version of package.json
, and edit that file to the version you want to commit.
Also worth noting : git gui
offers a perfectly functional "stage this line" action -- when you right click on any line in the diff displayed in the right pane.
Upvotes: 3