La migration vers PrestaShop 9 casse les .gitignore hérités de PS8 ou pire, de PS1.7. Voici un fichier à jour, construit à partir du repo officiel PS9, avec les adaptations nécessaires pour un thème custom.
Ce qui change vraiment avec PrestaShop 9
Avant de coller le fichier, les points qui justifient de ne pas juste recycler l’ancien :
Nouveaux placeholders dans img/ PS9 ajoute img/app_icon.png, img/module/default.png, img/e/, img/pr/ et img/pr/default.jpg. Sans eux dans le .gitignore, Git considère le dossier img/ entier comme vide et ignore ces fichiers au prochain clone.
/admin-dev/bundles/* PS9 génère un dossier bundles/ dans le back-office. Il doit être ignoré. Dans l’officiel, le dossier s’appelle admin-dev (c’est le nom dans le dépôt core). En prod, c’est le nom de ton dossier admin renommé — à adapter (voir plus bas).
config/defines_custom.inc.php Le fichier de surcharge des constantes s’appelle désormais defines_custom.inc.php, pas defines.inc.php. Si tu ignores le mauvais nom, tu risques de versionner (ou pire, de ne pas versionner) le bon.
Variables d’environnement Symfony PS9 s’appuie plus explicitement sur les .env. Les fichiers .env.local, .env.local.php et .env.*.local doivent être ignorés.
var/modules/ Un nouveau répertoire Symfony à préserver avec son .gitkeep, absent des .gitignore PS8.
themes/_core Un nouveau dossier de ressources partagées entre thèmes, à whitelister explicitement.
Gérer ton dossier admin
Le repo officiel PS utilise admin-dev comme nom de référence. En prod, PrestaShop renomme ce dossier automatiquement à l’installation. Dans le fichier ci-dessous, remplace toutes les occurrences de [TON_DOSSIER_ADMIN] par le vrai nom de ton dossier back-office.
Gérer ton thème custom
La règle par défaut du .gitignore officiel ignore tous les thèmes sauf classic et _libraries. Pour un thème custom, il faut le whitelister explicitement :
themes/*/
!themes/_core
!themes/_libraries
!themes/[TON_THEME]
Puis gérer les exclusions internes au thème :
themes/[TON_THEME]/_dev/
themes/[TON_THEME]/assets/cache/*
themes/[TON_THEME]/node_modules/
themes/[TON_THEME]/assets/css/*.map
themes/[TON_THEME]/assets/js/*.map
Les .map sont ignorés : ils n’ont rien à faire en production. Si tu rebuildes en CI/CD, tu peux aussi ignorer assets/css/ et assets/js/ entiers et les régénérer au déploiement — mais c’est un autre sujet.
Le fichier .gitignore complet
Copie, remplace les deux placeholders, c’est prêt.
# Cache, temp and personal files
/.htaccess
/.htpasswd
*.log
npm-debug.log.*
.sass-cache/
*.swp
*.swo
.cache/
# Cache
/cache/*
!/cache/.htaccess
!/cache/cachefs/index.php
!/cache/deprecated.txt
!/cache/index.php
!/cache/purifier/index.php
!/cache/push/activity
!/cache/push/index.php
!/cache/push/trends
!/cache/sandbox/index.php
!/cache/smarty/cache/index.php
!/cache/smarty/compile/index.php
!/cache/smarty/index.php
!/cache/tcpdf/index.php
# Download
/download/*
!/download/.htaccess
!/download/index.php
# Images
/img/*
!/img/.htaccess
!/img/index.php
!/img/404.gif
!/img/app_icon.png
!/img/bg_500.png
!/img/bg_loader.png
!/img/favicon.ico
!/img/loader.gif
!/img/loadingAnimation.gif
!/img/logo.jpg
!/img/logo.png
!/img/logo_invoice.jpg
!/img/logo_stores.png
!/img/macFFBgHack.png
!/img/module/default.png
!/img/prestashop-avatar.png
!/img/prestashop@2x.png
!/img/preston-login-wink@2x.png
!/img/preston-login@2x.png
!/img/questionmark.png
!/img/genders/index.php
!/img/admin/index.php
!/img/c/index.php
!/img/cms/index.php
!/img/co/index.php
!/img/e/index.php
!/img/jquery-ui
!/img/l/index.php
!/img/m/index.php
!/img/os/index.php
!/img/p/index.php
!/img/pr/index.php
!/img/pr/default.jpg
!/img/s/index.php
!/img/scenes
!/img/st/index.php
!/img/su/index.php
!/img/t/index.php
!/img/tmp/index.php
# Upload
/upload/*
!/upload/.htaccess
!/upload/index.php
/docs/phpdoc-sf/
*.hot-update.js
*.hot-update.json
# Admin — remplace [TON_DOSSIER_ADMIN] par ton vrai nom de dossier
/[TON_DOSSIER_ADMIN]/autoupgrade/*
!/[TON_DOSSIER_ADMIN]/autoupgrade/index.php
!/[TON_DOSSIER_ADMIN]/autoupgrade/backup/index.php
/[TON_DOSSIER_ADMIN]/backups/*
!/[TON_DOSSIER_ADMIN]/backups/.htaccess
/[TON_DOSSIER_ADMIN]/import/*
!/[TON_DOSSIER_ADMIN]/import/.htaccess
!/[TON_DOSSIER_ADMIN]/import/index.php
/[TON_DOSSIER_ADMIN]/export/*
!/[TON_DOSSIER_ADMIN]/export/.htaccess
!/[TON_DOSSIER_ADMIN]/export/index.php
/[TON_DOSSIER_ADMIN]/bundles/*
# Downloaded RTL files
/[TON_DOSSIER_ADMIN]/themes/default/css/bundle/default_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/bundle/shared_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/font_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/overrides_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/vendor/font-awesome/font-awesome_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/vendor/nv.d3_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/css/vendor/titatoggle-min_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/public/theme_rtl.css
/[TON_DOSSIER_ADMIN]/themes/default/public/*
!/[TON_DOSSIER_ADMIN]/themes/default/public/theme.rtlfix
/[TON_DOSSIER_ADMIN]/themes/new-theme/css/module/drop_rtl.css
/[TON_DOSSIER_ADMIN]/themes/new-theme/css/right-sidebar_rtl.css
/[TON_DOSSIER_ADMIN]/themes/new-theme/public/*
!/[TON_DOSSIER_ADMIN]/themes/new-theme/public/theme.rtlfix
themes/*/cache/*
themes/core.js
themes/core.js.map
themes/*-chunk.js
themes/*-chunk.js.map
# Install folder
/install-dev/theme/custom/*
!/install-dev/theme/custom/.gitkeep
# Config
/.env.local
/.env.local.php
/.env.*.local
config/defines_custom.inc.php
config/settings.inc.php
config/settings.old.php
config/xml/*
config/themes/*
!config/xml/themes/default.xml
themes/*/config/settings_*.json
app/config/parameters.old.yml
app/config/config.php
# Themes, modules and overrides
modules/*
override/*
themes/*/
!themes/_core
!themes/_libraries
!themes/[TON_THEME]
# Thème custom — exclusions internes
themes/[TON_THEME]/_dev/
themes/[TON_THEME]/assets/cache/*
themes/[TON_THEME]/node_modules/
themes/[TON_THEME]/assets/css/*.map
themes/[TON_THEME]/assets/js/*.map
# Vendors and dependencies
bower_components/
node_modules/
composer.phar
php-cs-fixer
.grunt/*
# Translations and emails templates
translations/*
!translations/default
mails/*
!mails/themes/
!mails/_partials/
themes/default-bootstrap/lang/*
themes/default-bootstrap/modules/*/translations/*.php
themes/default-bootstrap/mails/*
!themes/default-bootstrap/mails/en/
themes/default-bootstrap/modules/*/mails/*
!themes/default-bootstrap/modules/*/mails/en
# MISC
*sitemap.xml
/robots.txt
# Symfony
/bin/
/.web-server-pid
/app/Resources/geoip/GeoLite2-City.mmdb
/app/Resources/translations/*
!/app/Resources/translations/default
/app/config/parameters.yml
/app/config/parameters.php
/build/
/phpunit.xml
/var/*
!/var/cache
/var/cache/*
!var/cache/.gitkeep
!/var/logs
/var/logs/*
!var/logs/.gitkeep
!/var/sessions
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
!var/class_stub.php
!/var/modules
/var/modules/*
!/var/modules/.gitkeep
/vendor/
/web/bundles/
# Docker
install.lock
docker-compose.override.yml
.docker/ssl.crt
.docker/ssl.key
# DotEnv
/.env.local
/.env.local.php
/.env.*.local
# Tests
.phpunit.result.cache
.twig-cs-fixer.cache
# macOS
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# IDE
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/contentModel.xml
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
.idea/**/gradle.xml
.idea/**/libraries
.idea/**/mongoSettings.xml
.idea/replstate.xml
.idea/httpRequests
.idea/caches/build_file_checksums.ser
*.iws
out/
.idea_modules/
atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
Ce que ce fichier ne couvre pas intentionnellement
/robots.txt est ignoré — c’est le comportement du repo officiel PS9, qui génère ce fichier dynamiquement depuis le back-office. Si tu as un robots.txt custom statique à versionner, retire cette ligne.
modules/* ignore tout — les modules ne sont pas versionnés ici. Si tu développes un module custom, ajoute une exception : !modules/[TON_MODULE].
override/* ignore tout — même logique. Si tu as des overrides à versionner, whiteliste-les.
Construit à partir du .gitignore officiel branche develop du dépôt PrestaShop/PrestaShop, vérifié en juin 2026.