개발/etc

[git] git 오류 - Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch.

JH._.kim 2023. 5. 24. 12:00
Merge remote-tracking branch 'origin'
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' must be ignored, and an empty message aborts
# the commit.

 

내 로컬 브랜치의 변경내용을 커밋하고 원격 브랜치의 최신 내용을 pull 받으려고 할 때, (git pull origin '브랜치') 

위와 같이 이 merge가 필요한 지 커밋메시지를 입력하라는 메시지가 뜬다.

그런데 이 상태에서는 아무것도 입력이 안된다.

커밋메시지를 입력하고 merge 하는 방법은 다음과 같다.

 

1. i 를 누른다 (insert mode)

2. i 를 누르면 입력 모드로 변경되는데, 위의 메시지가 떠있는 상태에서 그대로 입력되니 저 오류 메시지는 신경쓰지말고 바로 커밋메시지를 입력하면 된다. 

3. esc를 누른다 (insert mode 종료)

4. :wq를 누른다 (저장 후 나가기)

5. enter를 누르고 git push를 하면 merge가 완료된다.

 

만약 아무 커밋메시지도 입력하고 싶지 않다면, 그냥 바로 :wq를 눌러도 가능은 하다.

 

728x90