[Git] GitHub에 이미 올린 파일 history에서 삭제하기


1. .gitignore에 추가하기

2. 변경사항 github에 반영하기

git add .
git commit -m "rm cache"
git push origin main

3. 캐시 삭제하기


git rm -r --cached .
git add .
git commit -m "rm cache"
git push origin main

4. History에서 지워주기

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch 경로/경로/파일명.확장자' --prune-empty --tag-name-filter cat -- --all

5. 바뀐 내용을 github에 반영!

git add .
git commit -m "[Delete] GoogleService-Info.plist from history"
git push origin --force --all