Skip to content

Instantly share code, notes, and snippets.

@filipkral
Last active October 10, 2017 19:05
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 filipkral/a79b8f7d8df20a83d0e5d3be0f186be9 to your computer and use it in GitHub Desktop.
Save filipkral/a79b8f7d8df20a83d0e5d3be0f186be9 to your computer and use it in GitHub Desktop.
Reduce repository size after you accidentally committed a large file.
# given that you accidentally added a large file to git branch feature/adding, then removed it in another commit, you can reduce the repo size by the following commands
# for more details and alternatives see https://confluence.atlassian.com/bitbucket/reduce-repository-size-321848262.html
git checkout develop
git merge --squash feature/adding
git branch -D feature/adding
#git reflog expire --expire=now --all
git gc --prune=now
git commit -m "Merged"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment