Skip to content

Instantly share code, notes, and snippets.

@brokenmold
Last active Jun 24, 2022
Embed
What would you like to do?
Wipe oops'd .env's from GitHub
*** Removes most recent unpushed env commit & adds env to gitignore ***
echo '.env' >> .gitignore
git rm -r --cached .env
git add .gitignore
git commit -m 'untracking .env'
git push origin master
*** Removes all env instances from commit history ***
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD
git push --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment