- Check the size
du .git/object or git count-objects -v
- find unwanted files
git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch filename' --prune-empty -f -- --all
- Reclaim space
rm -rf .git/refs/original/\n
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
- Push the cleaned repository
git push origin --force --all
(for all repository)git push origin --force --tags
(for all tags) - Tell your teammates
git rebase or take fresh code
(git clone)
for further detail refer to nice article here or this or this