반응형

.gitignore will prevent untracked files from being added (without an add -f) to the set of files tracked by git, however git will continue to track any files that are already being tracked.

To stop tracking a file you need to remove it from the index. This can be achieved with this command.

구글번역 : .gitignore는 추적되지 않은 파일이 git에 의해 추적 된 파일 세트에 추가 (-f없이)되는 것을 방지하지만, git은 이미 추적중인 파일을 계속 추적합니다. 파일 추적을 중지하려면 색인에서 파일을 제거해야합니다. 이것은이 명령으로 달성 할 수 있습니다.

git rm --cached <file>

 

If you want to remove a whole folder, you need to remove all files in it recursively.

구글번역 : 전체 폴더를 제거하려면 해당 폴더의 모든 파일을 재귀 적으로 제거해야합니다.

 

git rm -r --cached <folder>

The removal of the file from the head revision will happen on the next commit.

WARNING: While this will not remove the physical file from your local, it will remove the files from other developers machines on next git pull.

구글 번역 : 헤드 개정에서 파일 제거는 다음 커밋에서 발생합니다.

경고 : 로컬에서 실제 파일을 제거하지는 않지만 다음 git pull에서 다른 개발자 컴퓨터에서 파일을 제거합니다.

 

출처 : https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore

반응형

+ Recent posts