Skip to content

Instantly share code, notes, and snippets.

@x684867
Created September 17, 2014 12:39
Show Gist options
  • Save x684867/48101a206ba33443c962 to your computer and use it in GitHub Desktop.
Save x684867/48101a206ba33443c962 to your computer and use it in GitHub Desktop.
This gist covers how to prune large files from a git repo when moving from gitlab to github. It's also helpful for times when someone commits a large .war .iso or other file to the repo.
# Example specifies *.war.
#
# It would work for *.log for developers who git -A . when they shouldn't and upload the contents of /var/log/*
# Just change the --ignore-unmatch parameter.
#
git filter-branch \
--prune-empty \
-d ../scratch \
--index-filter "git rm --cached -f --ignore-unmatch *.war" \
--tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment