patch - git staging patches: with hunk smaller than a line -


i looking make interactive patch unique commit. use output similar

git diff --word-diff=porcelain [file] 

for interactive patching. command

git add --edit 

propose hunk least 1 line?

aim: have patch text files , stage changing in "libreoffice" accept or reject changes.


example:

a text file in 1 line:

echo "thiis sentence 1 wrong word. clean sentence. thhe laast 1 iss alwaays morre dificult" > text.txt 

to commit

git add text.txt git commit -m "one" 

modifiying file

echo "this sentence 1 wrong word. clean sentence. last 1 more difficult" > text.txt  git add -e 

should automatically cut in 3 hunks

"thiis" > "this" "thhe laast" > "the last" "iss alwaays morre dificult"> "is more difficult" 

i can obtain

--- a/text.txt +++ b/text.txt @@ -1 +1 @@ -thiis sentence 1 wrong word. clean sentence. thhe laast 1 iss alwaays morre dificult +this sentence 1 wrong word. clean sentence. last 1 more difficult 

note: @ best "without introduc[ing] confusing changes index" (# editing patches)

no, standard tools git hunks use lines (or set of changed lines in near vicinity). however, git doing taking snapshot of file in each of 3 states; replay if have access changes. first, 1 of changes (then commit), replay second change (then commit) , on.

it's not worth doing on word-by-word basis though - you'll end many commits no real standalone relevance.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -