-
-
Save salcode/10017553 to your computer and use it in GitHub Desktop.
# ----------------------------------------------------------------- | |
# .gitignore | |
# Bare Minimum Git | |
# https://salferrarello.com/starter-gitignore-file/ | |
# ver 20221125 | |
# | |
# From the root of your project run | |
# curl -O https://gist.githubusercontent.com/salcode/10017553/raw/.gitignore | |
# to download this file | |
# | |
# This file is tailored for a general web project, it | |
# is NOT optimized for a WordPress project. See | |
# https://gist.github.com/salcode/b515f520d3f8207ecd04 | |
# for a WordPress specific .gitignore | |
# | |
# This file specifies intentionally untracked files to ignore | |
# http://git-scm.com/docs/gitignore | |
# | |
# NOTES: | |
# The purpose of gitignore files is to ensure that certain files not | |
# tracked by Git remain untracked. | |
# | |
# To ignore uncommitted changes in a file that is already tracked, | |
# use `git update-index --assume-unchanged`. | |
# | |
# To stop tracking a file that is currently tracked, | |
# use `git rm --cached` | |
# | |
# Change Log: | |
# 20240826 unignore .dockerignore | |
# 20221125 ignore /dist directory | |
# unignore /.git-blame-ignore-revs | |
# 20220720 ignore /build directory | |
# 20220128 unignore .nvmrc | |
# 20210211 unignore .env.example | |
# 20190705 ignore private/secret files | |
# 20181206 remove trailing whitespaces | |
# 20180714 unignore .phpcs.xml.dist | |
# 20170502 unignore composer.lock | |
# 20170502 ignore components loaded via Bower | |
# 20150326 ignore jekyll build directory `/_site` | |
# 20150324 Reorganized file to list ignores first and whitelisted last, | |
# change WordPress .gitignore link to preferred gist, | |
# add curl line for quick installation | |
# ignore composer files (vendor directory and lock file) | |
# 20140606 Add .editorconfig as a tracked file | |
# 20140418 remove explicit inclusion | |
# of readme.md (this is not an ignored file by default) | |
# 20140407 Initially Published | |
# | |
# ----------------------------------------------------------------- | |
# ignore all files starting with . or ~ | |
.* | |
~* | |
# ignore node/grunt dependency directories | |
node_modules/ | |
# Ignore build directories. | |
/build | |
/dist | |
# ignore composer vendor directory | |
/vendor | |
# ignore components loaded via Bower | |
/bower_components | |
# ignore jekyll build directory | |
/_site | |
# ignore OS generated files | |
ehthumbs.db | |
Thumbs.db | |
# ignore Editor files | |
*.sublime-project | |
*.sublime-workspace | |
*.komodoproject | |
# ignore log files and databases | |
*.log | |
*.sql | |
*.sqlite | |
# ignore compiled files | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# ignore packaged files | |
*.7z | |
*.dmg | |
*.gz | |
*.iso | |
*.jar | |
*.rar | |
*.tar | |
*.zip | |
# ignore private/secret files | |
*.der | |
*.key | |
*.pem | |
# -------------------------------------------------------- | |
# BEGIN Explictly Allowed Files (i.e. do NOT ignore these) | |
# -------------------------------------------------------- | |
# track these files, if they exist | |
!.dockerignore | |
!.editorconfig | |
!.env.example | |
!.git-blame-ignore-revs | |
!.gitignore | |
!.nvmrc | |
!.phpcs.xml.dist |
Thanks for the sharing. I will try this file and send you feedback. It looks very good. ;-)
This is great! I think adding .DS_Store
in a misc
category would be a good idea 😄
Hi @YashTotale,
I believe
# ignore all files starting with . or ~
.*
should ignore .DS_Store
. If you are seeing any different behavior let me know.
One note is that if you've added a file (e.g. .DS_Store
) to your Git repo before you add this .gitignore
, the file will not be ignored because it is already part of the repo.
Oh, I glossed over that section. Thanks!
Should we add .env to it too? Like I am new to .gitignore usage so I just had that doubt.
Yes, .env
should be excluded. See Should I add .env to .gitignore?.
In this case, I'm ignoring all files that start with a period with a few exceptions (you can read more about this technique at .gitignore Hidden Files with Exceptions).
Reviewing this made me realize, I had not added .env.example
to my list of allowed files that start with a period (.
), so I've updated this .gitignore
- thanks.
Thank you soo much! This is really helpfull.
Yes,
.env
should be excluded. See Should I add .env to .gitignore?.In this case, I'm ignoring all files that start with a period with a few exceptions (you can read more about this technique at .gitignore Hidden Files with Exceptions).
Reviewing this made me realize, I had not added
.env.example
to my list of allowed files that start with a period (.
), so I've updated this.gitignore
- thanks.
The .vscode/extensions.json
file should not be ignored.
@Keyacom
I don't think it makes sense to include an editor specific file, like .vscode/extensions.json
, in a Git repo.
I'm certainly open to hearing other thoughts but for now I don't have any plans in changing this behavior.
Tnx! but some build tools and module blunders use the /dist
folder for build outputs like Webpack.
@r3x4w
If I understand correctly, you're suggesting I add /dist
to this .gitignore
file.
Sure, that sounds like a good idea 👍
Add this to the github/gitignore collection.
Thank you!
Could you please add the .dockerignore
file to the list of explicitly allowed files starting with a dot (.
)?
@ictus4u Good suggestion, thanks! I've added .dockerignore
to the allow list 👍
Thanks for the sharing!