Recent Posts
Recent Comments
Archives
반응형
250x250
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Today
Yesterday

Total
05-10 04:05
관리 메뉴

Hey Tech

[Git] Pull 또는 Checkout 시 에러 해결하기: error: Your local changes to the following files would be overwritten by checkout: 본문

SW 개발/Git

[Git] Pull 또는 Checkout 시 에러 해결하기: error: Your local changes to the following files would be overwritten by checkout:

Tony Park 2022. 1. 12. 10:15
728x90
반응형

❗ 에러 상황

checkout (branch 이동) 또는 pull 시 발생

📑 에러 메시지

error: Your local changes to the following files would be overwritten by checkout:
        ...
Please commit your changes or stash them before you switch branches.
Aborting

✨ 해결 방법

Step 1) 변동사항 스택 내 저장

stash: 현재 Staging 영역 내 파일의 변동사항을 스택에 넣어두기

git stash

Step 2) checkout 또는 pull 시행

checkout 희망 시

git checkout [변경할 branch 이름]

pull 희망 시

git pull origin [branch 이름]

Step 3) 스택 내 데이터 삭제

git stash pop

Advanced) 요약된 명령어

checkout 희망 시

git stash && git checkout [변경할 branch 이름] && git stash pop

pull 희망 시

git stash && git pull origin [branch 이름] && git stash pop

포스팅 내용에 오류가 있다면 아래에 댓글 부탁드립니다.

그럼 오늘도 즐거운 하루 보내시길 바랍니다 :)

고맙습니다.

728x90
반응형
Comments