Skip to content

Instantly share code, notes, and snippets.

@carl0zen
Last active August 29, 2023 20:40
Show Gist options
  • Save carl0zen/d6e6f629d1bea1378c613da71f0c2667 to your computer and use it in GitHub Desktop.
Save carl0zen/d6e6f629d1bea1378c613da71f0c2667 to your computer and use it in GitHub Desktop.
Remove .env from commit history
// Add to .gitignore
printf "\n.env*" >> .gitignore
// Run this command
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD
// Force push
git push --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment