Skip to content

Instantly share code, notes, and snippets.

@joostvanveen
Created March 17, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joostvanveen/96af36a6a8b70ab9f883 to your computer and use it in GitHub Desktop.
Save joostvanveen/96af36a6a8b70ab9f883 to your computer and use it in GitHub Desktop.
Remove big files from git history to avoid error
# This command removes any sql.gz SQL backup file from history, even if it was committed a few commits ago.
# Handy for big files that throw an error when trying to push. As always, rewriting git history is a
# dangerous action! Do not rewrite for commits that have already been fetched by fellow developers.
git filter-branch --prune-empty -d /path/to/tmp/scratch/dir --index-filter "git rm --cached -f --ignore-unmatch *.sql.gz" --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment