▶ 해결방법 1 : git stash
- 현재 디렉토리의 파일을 임시로 백업하고 깨끗한 상태로 돌린다.
- 버전관리 되는 대상 파일들을 임시저장 해둔다고 보면 된다.
1) 해당 명령어를 통해 현재 Staging 영역에 있는 파일의 변경사항을 스택에 넣어 둔다.
#git stash
2) master에서 pull하거나, git checkout 등 원격 저장소에서 내 로컬 브랜치로 변경사항을 적용한다.
# git pull origin master
3) 변경 사항을 적용하고, 스택에서 제거 한다.
# git stash pop
한번에 실행 할 수도 있다.
# git stash && git pull origin master && git stash pop
이후 정상적으로 git pull이 가능 한 것을볼 수 있다.
▶ 해결방법 2 : git add
- 위와 같은 방법으로 간단히 해결할 수도 있지만 git status를 통해서 가이드를 확인했듯이
git add를 통해 해당 파일을 staging 영역에 저장하고 git pull 작업을 해도 해당 오류는 해결 가능하다.
ex)
git status
On branch master
Your branch is behind 'origin/master' by 29 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: 소스~
no changes added to commit (use "git add" and/or "git commit -a")
출처: https://goddaehee.tistory.com/253
[Git (6)] git pull 에러 해결방법 (Your local changes to the following files would be overwritten by merge )
[Git (6)] git pull 에러 해결 (Your local changes to the following files would be overwritten by merge ) 안녕하세요. 갓대희 입니다. 이번 포스팅은 [ git pull 충돌 에러 해결방법 ] 입니다. : ) 1. 원인 Git을 사용하여 작
goddaehee.tistory.com
'Git' 카테고리의 다른 글
[Git] Branch란? (0) | 2023.01.30 |
---|---|
[Git] 깃의 구성, Git Areas (0) | 2023.01.30 |
[Git] Github 토큰 생성 방법 (0) | 2023.01.30 |
[Git] intellij 로 git 협업하기 - 2 인텔리제이 깃 연동 (0) | 2023.01.30 |
[Git] intellij 로 git 협업하기 - 1 윈도우 10 git 설치하기 (0) | 2023.01.30 |
댓글