【发布时间】:2015-07-05 13:38:32
【问题描述】:
我希望从一个独特的提交中制作一个交互式补丁。我想使用类似于
的输出git diff --word-diff=porcelain [file]
用于交互式修补。命令
git add --edit
只建议至少一行的大块?
目标:我有一个文本文件的补丁,我想在“LibreOffice”中接受或拒绝更改。
示例:
一行文本文件:
echo "Thiis is a sentence with one wrong word. This is a clean sentence. Thhe laast one iss alwaays morre dificult" > text.txt
提交
git add text.txt
git commit -m "one"
修改文件
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
应该自动切成3块
"Thiis" > "This"
"Thhe laast" > "The last"
"iss alwaays morre dificult"> "is always more difficult"
我可以得到
--- 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
注意:最好 "without introduc[ing] confusing changes to the index" (# EDITING PATCHES)
【问题讨论】: