Programing

빈 커밋 메시지로 인해 커밋 중단

lottogame 2020. 11. 13. 07:41
반응형

빈 커밋 메시지로 인해 커밋 중단


초보자 git 사용자로서 작업을 수행하려고 할 때

git commit -a -v

편집기에 커밋 메시지를 입력하고 파일을 닫으면 다음 오류가 발생합니다.

Aborting commit due to empty commit message.

나는이 문제를 다루는 거의 모든 주제를 읽었고, 편집자들을 바꾸었고, 기본적으로 모든 것을 시도했지만 아무것도 도움이되지 않았습니다. 어떻게해야합니까?

내가 알아 차린 것은 메모장 ++로 전체 프로세스를 시도하는 동안 파일을 저장할 수 없다는 것입니다.

가능한 해결 방법은 다음과 같습니다.

git commit -am "SomeComment"

그러나 그렇게함으로써 나는 git 사용의 목적을 무효화하고 있다고 느낍니다. 변경 사항을 제대로 문서화하고 싶습니다.


Git 구성에서 편집기를 설정할 때 매개 변수 "-w"를 전달하여 Git이 사용자 정의 편집기에 입력하는 커밋 메시지를 기다리도록합니다.

git config --global core.editor "[your editor] -w"

커밋 주석이 #문자로 시작하는 한 줄이면이 ​​오류가 발생할 수 있습니다 . 예를 들어 커밋 메시지 텍스트 편집기 창에서 다음과 같이 끝났을 때이 오류가 발생했습니다.

#122143980 - My commit message was here. The number to the left is a Pivotal Tracker story/ticket number that I was attempting to reference in the commit message.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch [MYBRANCH]
# Your branch is up-to-date with 'origin/[MYBRANCH]'.
#
# Changes to be committed:
#   modified:   [MYFILE1]
#   modified:   [MYFILE2]
#

물론 문제는 내 커밋 메시지가 #문자로 시작 했기 때문에 git은 그 줄을 주석으로 보았고 결과적으로 커밋 메시지가 주석 만 남았 기 때문에 비어있는 것으로 보았다는 것입니다!

수정 사항은 내 커밋 메시지를 #.

필자의 경우 Pivotal ID를 대괄호로 묶으면 git과 Pivotal 이 모두 만족 스러워 졌습니다 .

[#122143980] My commit message here. 

Visual Studio Code 용

git config --global core.editor "code -w"

원자 용

git config --global core.editor "atom -w"

숭고한

git config --global core.editor "subl -w"

적절한 (긴 여러 줄 주석) 문서로 커밋하고 싶지만 -m옵션이 필요하지 않은 경우 수행 할 수있는 작업 (그리고 커밋을 준비 할 때 수행하는 작업 )은 다음과 같습니다.

  • 별도의 파일 'doc-commit' (또는 원하는 이름 )에 문서를 작성하십시오 (변경하는 동안 ).
  • ' git commit -a -F /path/to/doc-commit'로 커밋 )

간단히 말해서 커밋 메시지로 별도의 파일 (원하는 경로에있을 수 있음)을 사용하십시오.


나는 또한 Git의 초보자입니다. 나는 기본적으로 당신과 같은 문제에 직면했습니다. 다음을 입력하여 해결했습니다.

git commit -a -m 'some message'

그 이유는 git은 메시지없이 커밋을 허용하지 않기 때문입니다. 일부 메시지를 커밋 명령과 연결해야합니다.


이 문제가 발생했습니다. 1.8.0 이전에 방금 설치했는데 위의 내용을 약간 수정해야한다는 것을 알았습니다. 나는이 모든 것에 대해 매우 새롭지 만 본질적으로 커밋 할 때 적어도 content.editor에 대해 설정된 것이 있다면 core.editor가 아닌 content.editor를 사용하는 것 같습니다.

그래서

git config --global content.editor "pico -w"

드디어 저를 맡게했습니다! 물론 사용하는 편집기를 사용하십시오.

이것이 언젠가 누군가에게 도움이되기를 바랍니다!


git은 메시지가 지정되지 않은 커밋을 허용하지 않습니다. 커밋 대화 상자에서 커밋 메시지를 지정 했습니까?

#으로 시작하는 줄은 Git에서 주석으로 처리되며 주석으로 간주되지 않으며 Git에서 무시됩니다.


내 아톰 편집기를 다음과 같이 구성했습니다.

git config --global core.editor "atom --wait"

하지만 내가했을 때

git commit

when atom was already launched, it opened a new tab for adding comments, but git wasn't waiting for me to save file and throwed "Aborting" message instantly. When I closed atom and tried to commit one more time, git launched atom and waited for comments to be added.


On windows machine for 'Sublime' editor we can also add the following line in .gitconfig file in the following folder [YOUR DRIVE LETTER]:/users/username/

[core]
  editor = '[YOUR DRIVE LETTER]:/Program Files/Sublime Text [YOUR VERSION NUMBER]/sublime_text.exe' --wait

Hope it helps.


First remove old entries of editors:

git config --global --unset-all core.editor
git config  --unset-all core.editor

Set your editor:

  • For Notepad++

    git config --global core.editor "Notepad++ -w"
    git config core.editor "Notepad++ -w"
    
  • For sublime

    git config --global core.editor "Notepad++ -w"
    git config core.editor "subl -w"
    

Make sure to sure a capital W.

git config --global core.editor "open -a 'Sublime Text 2' -W"

or use the following command to replace an existing one that isn't working properly.

git config --replace-all core.editor "open -a 'Sublime Text 2' -W"


For commenting on Notepad++ (Windows) do this:

1. Create a batch file somewhere (e.g. c:\Users\me\scripts\npp.bat)
Write this in the batch file (depending on where your Notepad++ is installed):

"C:\Program Files\Notepad++\notepad++.exe" -multiInst -notabbar -nosession -noPlugin "$*"

2. Save the batch file.
3. Open .gitconfig (which is usually in your Windows User folder) and make sure that
under [core] section you have:

editor = '"c:\\Users\\me\\scripts\\npp.bat"'

Or either run:

git config --global core.editor '"c:\Users\me\scripts\npp.bat"'

4. Now perform commit of some kind, and it will open Notepad++, git commit will now wait until notepad++ window is closed.


It expects a commit message.

For vim: ( I'm a newbie as well. I only worked with vim so far)

After your command,

git commit -v

You will be directed to a file with the name

".git/COMMIT_EDITMSG"

That opens up in your editor (which in my case is vim)

You will find a lot of commented text that looks exactly like what you saw when you did

git status  OR
git diff

If you notice, you can see an empty line on top - where it expects a commit message. You may type the commit message here and save & quit the editor. It's done!


I fixed the problem by switching from my fancy MacVim editor which opens a new window, to the standard default vim in /user/bin/vim which opens in the same window as the shell from whence it is called, and that seems to have fixed the problem.


I got this problem, and found out that if I dont put any comment after committing, it gives me that error. If I jump to get back to the main bash straight away, it doesnt commit.Just to be more clear, Im using GIT Bash, not other editor


When I used the complete atom filepath it didn't work, so instead of using:

git config --global core.editor "c:/programs/atom/atom.exe -w"

I used:

git config --global core.editor "atom -w"

and it worked just fine. Good luck!

IMPORTANT: First make sure that atom starts correctly calling it directly (atom) from the command line you are using.

참고URL : https://stackoverflow.com/questions/9725160/aborting-commit-due-to-empty-commit-message

반응형