솔솔

[GitHub]Your local changes to the following files would be overwritten by checkout 본문

나의보물들/Git | GitHub

[GitHub]Your local changes to the following files would be overwritten by checkout

솔솔하네 2022. 2. 23. 15:16
반응형
📍 Your local changes to the following files would be overwritten by checkout

팀프로젝트 진행하면서 '제브랜치'에서 'master branch'로 [checkout]하려니 이런에러가 뜨네요 ㅠㅠ

 

 

 

 

🔍 해결방법


에러 메세지를 잘 읽어보면 해결 방법이 나와있는데요

Please commit your changes or stash them before you switch branches.

(브랜치 바꾸기 전에 commit하거나 stash해라 )

 

- 방법1 : commit을 하면 되는데 돼신 내가 현재 작업에 대해서 이력을 남기고 싶지않은데 이력을 남겨야 된다는 단점이 있습니다.

 

- 방법2 : stash는 버전관리 대상을 임시저장하는 방법입니다.

# Staging 영역에 파일의 변경사항을 스택에 넣어둠. 
$ git stash

# stash 명령어로 스택에 넣어둔 변경 사항을 적용하고, 스택에서 제거하여줍니다.
$ git stash pop

# 원격 저장소의 master에서 pull을 하거나, git checkout master로 브랜치를 바꿀 수 있음. 
$ git pull origin master