Categories
포스트

GIT 에러 pull이 안될 때 Your local changes to the following files would be overwritten by merge

터미널에서 GIT pull 했을 때 아래와 같은 에러를 자주 볼 수 있습니다. GUI를 쓴다면 해당 파일을 Stash 하거나 지우면 되는데 서버에서 정리하는 법을 알아보겠습니다.

error: Your local changes to the following files would be overwritten by merge:
파일이름
Please commit your changes or stash them before you merge. 또는 Please commit your changes or stash them before you switch branches.
Aborting

더 자세한 내용을 보시려면 git status을 사용 하면 됩니다.

git stash

아직 끝내지 않은 수정사항을 스택에 잠시 저장했다가 나중에 다시 적용할 수 있습니다(브랜치가 달라져도 됩니다)

git stash
Saved working directory and index state WIP on main: 버전

stash 를 삭제 하는법

git stash drop - 가장 최근에 만든 stash 삭제
git stash drop stash@{ID} - 특정 stash ID 삭제(git stash list 치면 나오는 ID)
git stash clear - 모든 stash를 삭제

참고

  1. Git 도구 – Stashing과 Cleaning

댓글 남기기