インタラクティブなステージングをテストするために、特に差分を手動で編集するために、単一のテキスト ファイルを含むテスト リポジトリを作成しました。しかし、何を試しても、git は常に error: を返しましpatch does not apply
た。奇妙なのは、何も変更せずにテキスト エディターを閉じても、そのようになることです。編集者に依頼せずに問題のハンクをそのまま受け入れると、問題なくコミットできます。
Git を使い始めたばかりなので、何かを台無しにしてしまった可能性は十分にあります。これは私がしたことです:
$ create 'test' directory
$ open shell inside the directory
$ git init
$ create 'newfile.txt' inside the directory
$ git add newfile.txt
$ git commit -m 'first commit'
$ open newfile.txt, add 'line 1', save & exit
$ git add newfile.txt -e
$ editor comes up, close it without any modifications
$ error: newfile.txt: patch does not apply
(Win 7 64 と Git for Windows を使用)