
제목에서 알 수 있듯이 내 repo의 .gitignore 파일에 파일 경로를 넣었습니다. 하지만 해당 파일이 변경되면(자동으로 발생) 실행할 때 표시됩니다.git status
~/.dotfiles (master)✹ ᐅ git status
On branch master
Your branch is up to date with 'origin/master'.
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: home_stuff/.config/rofi/theme.rasi
no changes added to commit (use "git add" and/or "git commit -a")
그리고 이것은 .gitignore 파일에 내가 입력한 내용입니다.
home_stuff/.config/rofi/theme.rasi
그게 무슨 일이야?
답변1
때로는 이전에 추적된 파일을 캐시에서 제거해야 제대로 작동할 수 있습니다. 이 3가지 명령으로 이 문제를 해결할 수 있습니다.
git rm -r -cached .
(캐시와 모든 파일을 추적에서 제거합니다.)
git add .
(파일을 다시 추가하고 무시할 파일은 삭제합니다)
git commit
(새 파일 커밋)
답변2
Git에서 이미 추적한 파일은 영향을 받지 않습니다.
이는 설명의 두 번째 줄에 명시되어 있습니다.https://git-scm.com/docs/gitignore
현재 추적 중인 파일의 추적을 중지하려면 git rm --cached를 사용하세요.