I have an edited file in my git repo and want to add some of the changes to the staging area by using git add -p
.
There is an unsplittable hunk, that contains two added lines of which I want to add the second, but not the first. So I tried to remove the line I don't want to stage by editing the hunk:
# Manual hunk edit mode -- see bottom for a quick guide.
@@ -1,5 +2,7 @@
mod vec2;
#[cfg(test)]
mod vec2_tests;
pub use self::vec2::Vec2;
+pub use self::vec3::Vec3;
+use std::ops::{Add, AddAssign, Sub, SubAssign, Mul, MulAssign};
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
I removed the first added line: +pub use self::vec3::Vec3;
, saved and quit the editor.
Git tells me:
error: patch failed: src/geo/mod.rs:1
error: src/geo/mod.rs: patch does not apply
I don't get why that doesn't work. What's wrong here? How can I stage the second line, but not the first?