Skip to content

Instantly share code, notes, and snippets.

@yashprit
Last active August 29, 2015 14:06
Show Gist options
  • Save yashprit/7310b807eb446b0fa11b to your computer and use it in GitHub Desktop.
Save yashprit/7310b807eb446b0fa11b to your computer and use it in GitHub Desktop.
Cleaning up git repository
  1. Check the size du .git/object or git count-objects -v
  2. find unwanted files git filter-branch --tag-name-filter cat --index-filter 'git rm -r --cached --ignore-unmatch filename' --prune-empty -f -- --all
  3. Reclaim space
rm -rf .git/refs/original/\n
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
  1. Push the cleaned repository git push origin --force --all (for all repository) git push origin --force --tags (for all tags)
  2. Tell your teammates git rebase or take fresh code (git clone)
@yashprit
Copy link
Author

yashprit commented Sep 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment