git
.gitignore 없이 변경사항 추적하지 않기
연잔
2023. 8. 14. 14:07
로컬에서만 git에 추적되지 않았으면 하는 파일이 있을 때 사용
1. 프로젝트 최상단에서 exclude 파일을 연다.
vim .git/info/exclude
2. 파일 추가
i를 눌러 insert 모드로 변경한 후 제외시키고 싶은 파일을 적는다. (.gitignore와 형식 동일)
이후 esc를 누른 후 :wq 로 저장하고 나온다.
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
+) 이미 해당 파일이 존재할 경우 변경사항을 적용하는 명령어를 실행한다.
git update-index --skip-worktree
+) 적용후에도 changes에 나오는 경우 캐시를 지우고 다시 커밋한다.
git rm -r --cached .