.... → Stash → Apply Latest Stash 또는 Pop Latest Stash
알아서 병합되어 있는것을 볼 수 있습니다.
보충 설명
상황 요약
git pull 명령 실행 시 아래와 같은 오류가 발생했습니다:
error: Your local changes to the following files would be overwritten by merge:
.gitignore
Please commit your changes or stash them before you merge.
Aborting
→ 원인: 로컬에서 .gitignore 파일을 수정했는데, 원격 develop 브랜치에도 .gitignore 파일이 변경되어 있어 병합(merge) 시 충돌이 예상되기 때문에 Git이 안전장치로 pull을 중단한 것입니다.
목표: 최대한 빠르고 안전하게 원격 변경사항을 가져오고 싶으며, merge를 진행하고 싶다.
# 1. 현재 변경사항을 임시 저장 (스태시)
git stash push -m "임시 .gitignore 변경사항"
# 2. 원격 브랜치 가져오기 (pull)
git pull origin develop
# 3. 필요하면 스태시 복원
git stash pop
# (선택) 복원 후 충돌이 발생하면 직접 수정 후 커밋
git add .gitignore
git commit -m "Merge conflict resolved in .gitignore"