Skip to content

Instantly share code, notes, and snippets.

@diva-D
Created April 27, 2022 22:02
Show Gist options
  • Save diva-D/88a0a46f06303c3ec4d7852582089311 to your computer and use it in GitHub Desktop.
Save diva-D/88a0a46f06303c3ec4d7852582089311 to your computer and use it in GitHub Desktop.
# git only
git rm -r --cached .env
# commit and push to delete (but still in previous history)
# remove from Github history
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD
git push --force
# file still there but content will be empty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment