TIP
[GIT] git pull Error (error: Your local changes to the following files would be overwritten by merge)
Jay Son 아기 냥이 해린 짱💖
2020. 9. 8. 14:13
반응형
git pull 을 실행했지만 아래와 같이 Git 서버에 있는 수정 사항과 로컬 수정사항이 중복되어 git pull 동작이 되지 않음.
error: Your local changes to the following files would be overwritten by merge
$ git pull origin master
From https://github.com/JsonCorp/algorithm
* branch master -> FETCH_HEAD
error: Your local changes to the following files would be overwritten by merge:
.idea/qaplug_profiles.xml
.idea/sonarIssues.xml
Please commit your changes or stash them before you merge.
Aborting
Updating 4ddf588..55a7189
해결 방법
1. git stash를 실행하여 로컬 수정 사항을 제거한다.(자세한 동작은 제거가 아니고 잠시 감추는 동작)
$ git stash
아래 화면과 같이 임시 저장소에 수정 내용은 저장하고 작업 영역에는 삭제 되어 있음.
2. 다시 git pull origin master 실행하여 Git 서버에 수정 사항 업데이트
$ git pull origin master
정상적으로 업데이트 완료.
끝~~~
stash 내용 가져오기/삭제 등은 아래 명령어로 가능
$ git stash show
$ git stash apply
$ git stash drop
$ git stash pop
반응형