Skip to content

Instantly share code, notes, and snippets.

@vikjam
Last active November 6, 2020 18:18
Show Gist options
  • Save vikjam/cec2e1237a3e38b006dcafb7b4f0976d to your computer and use it in GitHub Desktop.
Save vikjam/cec2e1237a3e38b006dcafb7b4f0976d to your computer and use it in GitHub Desktop.
Ignore .env and specific folders in Git
# Ignore everything in this directory (place in the directory you want to ignore)
*
# Except this file
!.gitignore
# https://bcodes.io/blog/post/git-commit-config-files-but-ignore-future-changes
touch .env
git add .env
git commit -m "Add empty .env"
git push origin master
git update-index --skip-worktree .env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment