Last active
July 11, 2024 08:40
-
-
Save gjerokrsteski/e4a10352448158ba827493eb116cda51 to your computer and use it in GitHub Desktop.
remove env file from git history forever
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo '.env' >> .gitignore | |
git rm -r --cached .env | |
git add .gitignore | |
git commit -m 'untracking .env' | |
git push origin master |
Worked perfectly fine for me, Thanks.
This worked! Thanks
Thanks man!
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch application/.env.example' --prune-empty --tag-name-filter cat -- --all
Updated to work across branches
This did work to clear the commits from my history, but when checking the git tree with gitk --all
I see that this moves them off of the main remote, and I can still see the .env commits. How do I clear these? See photo of git tree
It worked for me, thanks!
Thank you, it really helps
It did work thank you!
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch application/.env.example' --prune-empty --tag-name-filter cat -- --all
It really worked thank you
Perfect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
worked for me, thanks!