Recently I've learned about the command git add -p to stage the file by hunks instead of staging the whole file.
I already used such feature in IntelliJ IDEA, but it is also possible to do via command line.
I would like to research if there is any git config option that given a file with changes such as
diff --git a/lorem b/lorem
index 1234567..9876543 abcdef7
--- a/lorem
+++ b/lorem
@@ -1,9 +1,9 @@
Quisquam explicabo et iste voluptatibus rerum.
-Voluptatibus iusto sit dolores.
+Dignissimos iusto sit dolores.
Iure eum ut delectus.
-Dolore nemo quia incidunt dignissimos quisquam.
+Libero nemo quia incidunt dignissimos quisquam.
Quos eos sit officia libero deleniti minus dolor.
it would automatically display the change Voluptatibus -> Dignissimos in a hunk,
and the next change Dolore -> Libero in the next hunk.
But because the number of unchanged lines in between (only 1, the one starting with Iure)
is too small, it groups them into a single hunk.
Recently I've learned about the command
git add -p
to stage the file by hunks instead of staging the whole file. I already used such feature in IntelliJ IDEA, but it is also possible to do via command line.I would like to research if there is any git config option that given a file with changes such as
it would automatically display the change
Voluptatibus
->Dignissimos
in a hunk, and the next changeDolore
->Libero
in the next hunk.But because the number of unchanged lines in between (only 1, the one starting with
Iure
) is too small, it groups them into a single hunk.