최초 글 작성 : 20.10.06
최근 글 수정 : 20.09.17
Committing is not possible because you have unmerged files.
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
U Day_17_18_19/src/movieController.js
U Day_17_18_19/src/movieRouter.js
U Day_17_18_19/src/views/edit.pug
상황
Day_23 디렉토리에 템플릿을 추가하고 커밋을 하려고 했더니 해당 오류가 발생했다.
해결
U 체크된 파일들에서 충돌이 난 것이므로 해당 파일을 열어서 충돌 난 부분을 삭제하거나 수정한다.
<<<< HEAD
pull 받은 코드
=========
기존 코드
>>>>
충돌 해결
failed to push some refs to ‘저장소주소’
git push 저장소_이름 브랜치_이름
위 명령어 사용 시, 해당 에러가 나올 때가 있다.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '저장소_주소'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
이 때, push 명령어에 -f를 붙여 강제 push하지 말고 pull로 해결하도록 하자.
(강제 push로 돌이킬 수 없는 강을 건넌 경험담은 구글에서 적지 않게 볼 수 있다.)
git pull 저장소_이름 브랜치_이름
명령어가 먹히지 않을 때는, 원격 저장소를 다시 추가git remote add 저장소_주소
후 시도해보자.
refusing to merge unrelated histories
pull 명령어 사용 시, 해당 에러가 발생할 때가 있다.
fatal: refusing to merge unrelated histories
원격 저장소와 로컬 저장소의 변경 내역이 다르기 때문에 발생하는 경고이다.
원격 저장소의 주소가 올바른지 확인 후, pull 명령어를 사용할 주소가 맞다면 아래 옵션을 추가하면 된다.
(원격 저장소의 주소를 잘못 가져온 줄 모르고 pull을 하는 실수를 저질렀다.)
git pull --allow-unrelated-histories
이전명령어