Skip to content

Instantly share code, notes, and snippets.

@Kapott
Created December 22, 2017 13:23
Show Gist options
  • Save Kapott/b43bb97f3c2e14dd4264f9ecb69e5a48 to your computer and use it in GitHub Desktop.
Save Kapott/b43bb97f3c2e14dd4264f9ecb69e5a48 to your computer and use it in GitHub Desktop.
Completely wipe a git repo's history. For those 'oh shit' moments.
#!/bin/bash
# remove git information
rm -rf .git
# re-initialize git with current state
git init
git add .
git commit -m "Initial commit"
# push to the repo, ensuring you overwrite all history
git remote add origin git@github.com:kapott/<INSERT_REPO_HERE>.git
git push -u --force origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment