All is well

[오늘의 에러/GitBash] fatal: invalid reference: / error: The following untracked working tree files would be overwritten by merge: 본문

오늘의 에러

[오늘의 에러/GitBash] fatal: invalid reference: / error: The following untracked working tree files would be overwritten by merge:

D0YUN 2025. 3. 21. 10:32

오늘의 에러1

fatal: invalid reference: ProductDataTable_fin

 

 

 

오류 원인

 

해결 방법 (선택지 2가지)

 

 

https://wakestand.tistory.com/808

 

Git local에 없는 branch switch 하는 방법

Git에 만들어져 있는 branch이긴 한데 local에 다운로드 받지 않았을 경우 git switch branch명으로 branch 변경이 되지 않는데 $ git switch branch명 fatal: invalid reference: branch명 이런 식의 에러가 뜨게 된다 여

wakestand.tistory.com

 


 

오늘의 에러2

error: The following untracked working tree files would be overwritten by merge:

 

오류 원인

Git은 파일을 병합하는 과정에서 로컬에서 수정되지 않은 파일은 덮어쓸 수 있지만, Git이 추적하고 있지 않은(untracked) 파일이 존재하면 덮어쓰기를 방지한다. 그래서 에러가 발생했다.

 

해결 방법 (선택지 2가지)

방법1) 로컬 경로의 파일 삭제하기 (로컬 변경 사항 무시)
만약 원격 저장소의 파일로 덮어써도 상관없다면, 로컬의 해당 파일을 삭제하면 됩니다.그런 다음 다시 병합을 시도합니다.

rm Content/DYL/Blueprints/BP_SuperGameMode.uasset

이후 병합 시도

git pull

 

방법2) Git의 원격 저장소 파일 삭제하기 (원격 저장소 변경 사항 무시)
만약 로컬 파일이 더 중요하고 원격 저장소에서 해당 파일을 업데이트하지 않기를 원한다면, 원격 저장소에서 해당 파일을 삭제하거나 .gitignore로 무시하도록 설정할 수 있습니다.

  • .gitignore에 추가하는 방법 (추적하지 않도록 설정)
echo "Content/DYL/Blueprints/BP_SuperGameMode.uasset" >> .gitignore
git rm --cached Content/DYL/Blueprints/BP_SuperGameMode.uasset
git commit -m "Ignore BP_SuperGameMode.uasset file"
git push

 

 


 

해결 과정

 

 

 


 

해결 완료