[git] git pull 에러 발생시 ( error: Your local changes to the following files would be overwritten by merge )

간혹 여러 소스를 관리하다보면 아래와 같이 git pull 을 사용할때 에러가 발생할 수 있습니다.

$ git pull origin master
error: Your local changes to the following files would be overwritten by merge:
course/course.php
course/modals/post/postListModal.php
course/modals/selectPostTypeModal.php
Please commit your changes or stash them before you can merge.
Aborting

이때 간단한 처리 방법은 git stash 을 통하여 처리가 가능합니다.

$git stash

$Saved working directory and index state WIP on master: 946dedf fix quotes problem
$HEAD is now at 946dedf fix quotes problem

일단 에러의 원인은 pull 로 가져오려는 소스와 현재 저장된 코드와 재대로 처리가 되지 않아서 나는 에러 입니다.
이때 stash 는 현재 디렉토리의 파일을 임시로 백업하고 깨끗한 상태로 돌립니다.

이제 다시 git pull origin master 를 할 경우 정상적으로 업데이트 되는 것을 확인 하실 수 있습니다.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now