I want to make an interactive patch from a unique commit. I would like to use output similar to
git diff --word-diff=porcelain [file]
for an interactive fix. Team
git add --edit
only offers hunk that are at least one line?
Purpose: I have a patch for text files, and I would like to change the change, as in "LibreOffice", accept or reject the changes.
Example:
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
commit
git add text.txt
git commit -m "one"
File modification
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 into 3 pieces
"Thiis" > "This"
"Thhe laast" > "The last"
"iss alwaays morre dificult"> "is always more difficult"
I can just get
+++ 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: in the best case, "does not introduce [confusing] changes to the index" (# EDITING PACKAGES)
source
share