Has this ever happened to you?
cue video of someone accidentally committing
super-secret-private-stuff.json
Time to blow away the entire project and start over right?
With git-obliterate
, you can make it seem like the file has never existed in the project's history!
First, read this because I'm mostly just scripting a lot of what they say here: https://help.github.com/articles/remove-sensitive-data
Download the file, chmod +x
it, and copy it to /usr/local/bin
(or somewhere else in your PATH
). Then you can do git obliterate <file>
and it will wipe it from history. Singing Cher's βIf I Could Turn Back Timeβ is optional. You will then have to git push --force
to update your remote.
After that's done, you'll need to force update your remotes with git push --force
, making sure to do all the branches and tags and everything that the file might have been in β if you're lucky, you will have caught it early and hopefully that should just be master
.
curl -O https://gist.githubusercontent.com/brianloveswords/7545299/raw/6128cb79b624d915bfc1942177a3508fd47efbfe/git-obliterate && chmod +x git-obliterate && sudo mv git-obliterate /usr/local/bin
Didn't work. Again. Thanks for being yet another thing that didn't work for me.
EDIT: Came back to say I actually had to blow away the project and start over. Your cute script was of 0 help to me.