[TIL] -잦은 git deleted mode

김주형·2023년 12월 13일
0

TIL

목록 보기
37/37

RN 프로젝트 진행하면서

애뮬레이터를 돌리거나 commit 중

갑자기 내 로컬 파일들이 삭제되길래

화들짝 놀라 구글링하다가

필요할 때 꺼내기 용으로 도움된 게시글 기록합니다

도움자료


대체 나한테 왜 이러는걸까

그래서 물어봤다

The terminal output shows that you attempted to pull changes from the main branch of your remote repository to your local repository. However, the pull operation was aborted because there are untracked files in your working tree that would be overwritten by the merge. These files are src/components/Profile.js and src/components/TabNavigator.js.

Here's the command you ran and the error message:

git pull origin main
error: The following untracked working tree files would be overwritten by merge:
        src/components/Profile.js
        src/components/TabNavigator.js
Please move or remove them before you merge.
Abortin

To resolve this issue, you have a few options:

If you don't need the changes in these files, you can remove them:

rm src/components/Profile.js src/components/TabNavigator.js

js
If you want to keep these files, you can move them to a different location:

rm src/components/Profile.js src/components/TabNavigator.js

Replace with the path where you want to move the files.

If you want to keep the changes in these files and include them in your repository, you can add them to the staging area and commit them:

git add src/components/Profile.js src/components/TabNavigator.js
git commit -m "Add untracked files"

After resolving the issue with the untracked files, you should be able to pull the changes from the remote repository.

친절한 copilot.. 따라해봤더니?


git reset --hard HEAD와 git fetch origin main
git reset --hard origin/main으로 복구하여

다시 커밋하는걸로 해결

정확히는 모르겠지만 아마 로컬 히스토리 캐시가 쌓이다보면 감당이 안되는 범위가 있는걸까 싶다

이런일 반복 금지하기 위한 고민들

profile
근면성실

0개의 댓글