0

エラーが発生することなく、Powershell または Git Bash で「git add -e」を実行できないようです。問題のファイル (test3.html) の内容は次のとおりです。

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
</head>
<body>
    Hello
</body>
</html>

最後の行にキャリッジ リターンがあることに注意してください。

ここで、次のコマンドを実行し、ローカルの git リポジトリからそれぞれの出力を受け取ります。

PS C:\repos\git-test> git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test3.html

no changes added to commit (use "git add" and/or "git commit -a")
PS C:\repos\git-test> git add -e
unix2dos: converting file C:/repos/git-test/.git/ADD_EDIT.patch to DOS format...
dos2unix: converting file C:/repos/git-test/.git/ADD_EDIT.patch to Unix format...
error: patch failed: test3.html:1
error: test3.html: patch does not apply

メモ帳で「git add -e」コマンドを入力すると、次のように表示されます。

diff --git a/test3.html b/test3.html
index 1663e8c..03366ee 100644
--- a/test3.html
+++ b/test3.html
@@ -1,8 +1,9 @@
 <!DOCTYPE html>
 <html>
 <head>
-   <title></title>
+   <title>test</title>
 </head>
-   <div>
-   </div>
+<body>
+   Hello
+</body>
 </html>

最後の行の後にキャリッジ リターンがあります。このファイルは元々、UTF-8 エンコーディングの notepad++ で書かれていました。

メモ帳を閉じるとすぐに、次のエラーが表示されます。

エラー: パッチに失敗しました: test3.html:1

エラー: test3.html: パッチは適用されません

質問: 特に ADD_EDIT.patch で何かを変更していないのに、これらのエラーが発生するのはなぜですか?

変更を個別のハンクに分割し、どの変更をコミットするかを決定する、より複雑なフローを試しました。同様の結果が発生します。そして、最も単純なフローでさえうまくいかない場合、それはどういう意味ですか...

これの背後にある私の理由は、Git に慣れていないので、Git にもっと慣れるためです。私はhttps://git-scm.com/docs/git-addを読んでいて、各オプションに従おうとしています。

私が見逃した可能性のある他の投稿へのヘルプ、提案、または参照はすべて大歓迎です。

編集:

私の構成は次のようになります。

PS C:\repos\git-test> git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.name=Dash
user.email=some.email.address@gmail.com
core.editor=notepad
core.whitespace=trailing-space,space-before-tab
help.autocorrect=1
color.ui=auto
gpg.program=c:/Program Files (x86)/GNU/GnuPG/gpg2.exe
gui.recentrepo=C:/Users/Dash/repos/public-repo-test
apply.whitespace=fix
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.excludesfile=C:\repos\gitignore_global.txt
remote.origin.url=https://Mister0wl@bitbucket.org/Mister0wl/using-git-with-a-gui.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
apply.whitespace=nowarn
4

0 に答える 0