얼마 전까지 만해도 나는 this question에게 물었습니다. 답변을 받았지만 문제가 해결되지 않아 새로운 질문을 더 많이 작성하도록 권고 받았습니다. Windows의 git bash 쉘 "편집 된 행크가 적용되지 않음"
그냥 (대화 형 명령 프롬프트가 표시되면 특히, 내가e
를 누름)
git add -p
를 사용하는 경우 수동으로 윈도우,에 망할 놈의 bash 쉘에서 큰 덩어리를 편집 할 때 나는 오류를 얻고, 반복합니다. 메모장 ++ (내 기본 .txt 편집기)에서 hunk에 대한 편집 파일을 엽니 다. 심지어
이 파일을 변경하지 않고, 내가 오류 주어진 오전 :
git config core.autocrlf
의 값이
false
입니다, 내가하는 REPO을 만든 최소한의 예를 들어
Your edited hunk does not apply
(나는 또한 시도한 다음 값을 true
으로 설정). 나는 .txt 파일 (foobar.txt
)을 가지고 있는데, 그 안에 foo
을 쓰고, 내 변경 내용을 커밋합니다. 그런 다음 파일 내용을
foo
bar
으로 변경 한 다음 파일을 닫습니다. 그때 git add -p foobar
수행하고 메시지입니다 (은 diff이 경우 정상적으로 작동하지 않았는지 확실하지,하지만 일반적으로 나를 위해 작동 않음) :
diff --git a/foobar b/foobar
index 1910281..a907ec3 100644
--- a/foobar
+++ b/foobar
@@ -1 +1,2 @@
-foo
\ No newline at end of file
+foo
+bar
\ No newline at end of file
Stage this hunk [y,n,q,a,d,/,e,?]?
어느 내가 e
에 응답 할 수 있습니다. 다시 말하지만, 변경하지 않고 나는 오류 얻을 :
error: patch failed: foobar:1
error: foobar: patch does not apply
Your edited hunk does not apply. Edit again (saying "no" discards!) [y/n]?
물론
, 나는 또한 수동 덩어리 편집 파일을 변경 시도를;
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1 +1,2 @@
-foo
\ No newline at end of file
+foo
+bar
\ No newline at end of file
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
#
# If the patch applies cleanly, the edited hunk will immediately be
# marked for staging. If it does not apply cleanly, you will be given
# an opportunity to edit again. If all lines of the hunk are removed,
# then the edit is aborted and the hunk is left unchanged.
샘플 편집은 다음과 같습니다 : 예를 들어, 편집 파일은 처음에 모양을
# Manual hunk edit mode -- see bottom for a quick guide
@@ -1 +1,1 @@
-foo
\ No newline at end of file
+foo
\ No newline at end of file
# ---
# To remove '-' lines, make them ' ' lines (context).
# To remove '+' lines, delete them.
# Lines starting with # will be removed.
#
# If the patch applies cleanly, the edited hunk will immediately be
# marked for staging. If it does not apply cleanly, you will be given
# an opportunity to edit again. If all lines of the hunk are removed,
# then the edit is aborted and the hunk is left unchanged.
또 다른 흥미로운 점은 내가 나를 수있는 Windows의 개발자 버전을 가지고있다 "Windows에서 우분투에서 배쉬"를 사용합니다. 이 유틸리티를 통해 git add -p
을 사용하고, hunks를 수동으로 편집하려고하면 작동 할 것입니다 ... 제 질문은 왜 저를 위해 배쉬 셸에서 작동하지 않습니까?