Skip to content

Instantly share code, notes, and snippets.

@imhamad
Created June 2, 2022 13:09
Show Gist options
  • Save imhamad/849b915e1352362ec776492790d171b1 to your computer and use it in GitHub Desktop.
Save imhamad/849b915e1352362ec776492790d171b1 to your computer and use it in GitHub Desktop.
Drupal 9 and onwards proper gitignore file structure
# Ignore IDE files from tracking
.idea
.DS_Store
# Ignore configuration files that may contain sensitive information from tracking
*/settings*.php
web/sites/*/*settings*.php
web/sites/*/*services*.yml
web/sites/*/settings*.php
web/sites/*/services*.yml
web/sites/*/default.*
# Excepting for creating settings.php
!web/sites/default/default.settings.php
# Ignore paths that may contain user-generated content
web/sites/*/public
web/sites/*/private
web/sites/*/files
web/sites/*/files-public
web/sites/*/files-private
web/sites/settings.local.php
# Ignore paths that may contain temporary files
web/sites/*/translations
web/sites/*/tmp
web/sites/*/cache
# Ignore testing related files
web/sites/simpletest
# Ignore composer packages files
/vendor
# Ignore drupal core (if not versioning drupal sources)
web/core
web/modules/README.txt
web/profiles/README.txt
web/sites/README.txt
web/sites/example.sites.php
web/sites/example.settings.local.php
web/sites/development.services.yml
web/themes/README.txt
web/.csslintrc
web/.eslintignore
web/.eslintrc.json
web/.htaccess
web/autoload.php
web/example.gitignore
web/index.php
web/LICENSE.txt
web/README.txt
web/INSTALL.txt
web/robots.txt
web/update.php
web/web.config
web/README.md
.editorconfig
.gitattributes
# Ignore Drupal contrib files
web/modules/contrib
web/themes/contrib
#Logs
.log
# Router file
web/.ht.router.php
@imhamad
Copy link
Author

imhamad commented Jun 2, 2022

We've tested this .gitignore with composer and ensured we're not tracking any unnecessary files to avoid any exacerbation during the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment