up

How to remove accidentally added files from git

I've read ti in stackoverflow:

E.g. to remove all *.gz files accidentally committed into git repository:

du -sh .git #==> e.g. 100M
git filter-branch --index-filter 'git rm --cached --ignore-unmatch *.gz' HEAD
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
Blog categories:  Programming
Blog tags:  programming  git

Add new comment