I am looking to make an interactive patch from a unique commit. I would like to use an output similar as
git diff --word-diff=porcelain [file]
for an interactive patching. The command
git add --edit
propose only hunk that are as least as one line?
Aim: I have a patch for a text files and I would like to stage the changing like in "LibreOffice" accept or reject changes.
Example:
A text file in one line:
echo "Thiis is a sentence with one wrong word. This is a clean sentence. Thhe laast one iss alwaays morre dificult" > text.txt
to commit
git add text.txt
git commit -m "one"
Modifiying the file
echo "This is a sentence with one wrong word. This is a clean sentence. The last one is always more difficult" > text.txt
git add -e
should be automatically cut in 3 hunks
"Thiis" > "This"
"Thhe laast" > "The last"
"iss alwaays morre dificult"> "is always more difficult"
I can just obtain
--- a/text.txt
+++ b/text.txt
@@ -1 +1 @@
-Thiis is a sentence with one wrong word. This is a clean sentence. Thhe laast one iss alwaays morre dificult
+This is a sentence with one wrong word. This is a clean sentence. The last one is always more difficult
Note: at the best "without introduc[ing] confusing changes to the index" (# EDITING PATCHES)