Skip to content

Instantly share code, notes, and snippets.

@adeelx
adeelx / purge.sh
Created October 2, 2018 18:04 — forked from vmassuchetto/purge.sh
Script to clean a Vagrant box before packaging it. Updated to work with Debian and some additional directories. It's also less general and does not remove any system packages at all.
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
# Unmount project
umount /vagrant

Delete the last commit, if it hasn't been pushed.

git reset --soft HEAD~1

Delete the last commit, if it has been pushed.

git reset --hard HEAD~1
git push origin HEAD --force

Temporarily ignore local changes to a file