PrestaShop 的 .gitignore
适用于 PrestaShop 的 135 条忽略规则,可直接复制到您的仓库。
电商平台
PrestaShop 的完整 .gitignore
# 由 LFGitignore - https://lfgitignore.com 生成
# 创建:2026-10-31 23:00:59 UTC
# 技术:Prestashop
### Prestashop ###
/.htaccess
# 日志档案
*.log
/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/.htaccess
!/download/index.php
/img/*
!/img/.htaccess
!/img/index.php
!/img/404.gif
!/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/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/jquery-ui
!/img/l/index.php
!/img/m/index.php
!/img/os/index.php
!/img/p/index.php
!/img/s/index.php
!/img/scenes
!/img/st/index.php
!/img/su/index.php
!/img/t/index.php
!/img/tmp/index.php
/upload/*
!/upload/.htaccess
/vendor/*
/docs/phpdoc-sf/
/composer.lock
*.hot-update.js
*.hot-update.json
/admin-dev/autoupgrade/*
!/admin-dev/autoupgrade/index.php
!/admin-dev/autoupgrade/backup/index.php
/admin-dev/backups/*
!/admin-dev/backups/.htaccess
/admin-dev/import/*
!/admin-dev/import/.htaccess
!/admin-dev/import/index.php
/admin-dev/export/*
!/admin-dev/export/.htaccess
!/admin-dev/export/index.php
/admin-dev/themes/default/css/bundle/default_rtl.css
/admin-dev/themes/default/css/bundle/shared_rtl.css
/admin-dev/themes/default/css/font_rtl.css
/admin-dev/themes/default/css/overrides_rtl.css
/admin-dev/themes/default/css/vendor/font-awesome/font-awesome_rtl.css
/admin-dev/themes/default/css/vendor/nv.d3_rtl.css
/admin-dev/themes/default/css/vendor/titatoggle-min_rtl.css
/admin-dev/themes/default/public/theme_rtl.css
/admin-dev/themes/new-theme/css/module/drop_rtl.css
/admin-dev/themes/new-theme/css/right-sidebar_rtl.css
themes/*/cache/*
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
modules/*
override/*
themes/*/
!themes/classic
!themes/_core
!themes/_libraries
bower_components/
# Node.js 依赖项
node_modules/
composer.phar
php-cs-fixer
.grunt/*
translations/*
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
*sitemap.xml
/robots.txt
/bin/
/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
/vendor/
/web/bundles/
这些 PrestaShop 规则实际上忽略了什么
以下列出了每个忽略模式及其加入 .gitignore 的原因。
缓存、临时文件和个人文件
| 模式 | 忽略的内容 |
|---|---|
/.htaccess |
缓存、临时文件和个人文件 |
*.log |
日志档案 |
缓存
| 模式 | 忽略的内容 |
|---|---|
/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/.htaccess |
下载 |
!/download/index.php |
下载 |
Images
| 模式 | 忽略的内容 |
|---|---|
/img/* |
Images |
!/img/.htaccess |
Images |
!/img/index.php |
Images |
!/img/404.gif |
Images |
!/img/bg_500.png |
Images |
!/img/bg_loader.png |
Images |
!/img/favicon.ico |
Images |
!/img/loader.gif |
Images |
!/img/loadingAnimation.gif |
Images |
!/img/logo.jpg |
Images |
!/img/logo.png |
Images |
!/img/logo_invoice.jpg |
Images |
!/img/logo_stores.png |
Images |
!/img/macFFBgHack.png |
Images |
!/img/prestashop-avatar.png |
Images |
!/img/prestashop@2x.png |
Images |
!/img/preston-login-wink@2x.png |
Images |
!/img/preston-login@2x.png |
Images |
!/img/questionmark.png |
Images |
!/img/genders/index.php |
Images |
!/img/admin/index.php |
Images |
!/img/c/index.php |
Images |
!/img/cms/index.php |
Images |
!/img/co/index.php |
Images |
!/img/jquery-ui |
Images |
!/img/l/index.php |
Images |
!/img/m/index.php |
Images |
!/img/os/index.php |
Images |
!/img/p/index.php |
Images |
!/img/s/index.php |
Images |
!/img/scenes |
Images |
!/img/st/index.php |
Images |
!/img/su/index.php |
Images |
!/img/t/index.php |
Images |
!/img/tmp/index.php |
Images |
上传
| 模式 | 忽略的内容 |
|---|---|
/upload/* |
上传 |
!/upload/.htaccess |
上传 |
/vendor/* |
上传 |
/docs/phpdoc-sf/ |
上传 |
/composer.lock |
上传 |
*.hot-update.js |
上传 |
*.hot-update.json |
上传 |
/admin-dev/autoupgrade/* |
上传 |
!/admin-dev/autoupgrade/index.php |
上传 |
!/admin-dev/autoupgrade/backup/index.php |
上传 |
/admin-dev/backups/* |
上传 |
!/admin-dev/backups/.htaccess |
上传 |
/admin-dev/import/* |
上传 |
!/admin-dev/import/.htaccess |
上传 |
!/admin-dev/import/index.php |
上传 |
/admin-dev/export/* |
上传 |
!/admin-dev/export/.htaccess |
上传 |
!/admin-dev/export/index.php |
上传 |
下载的 RTL 文件
| 模式 | 忽略的内容 |
|---|---|
/admin-dev/themes/default/css/bundle/default_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/bundle/shared_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/font_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/overrides_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/vendor/font-awesome/font-awesome_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/vendor/nv.d3_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/css/vendor/titatoggle-min_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/default/public/theme_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/new-theme/css/module/drop_rtl.css |
下载的 RTL 文件 |
/admin-dev/themes/new-theme/css/right-sidebar_rtl.css |
下载的 RTL 文件 |
themes/*/cache/* |
下载的 RTL 文件 |
配置
| 模式 | 忽略的内容 |
|---|---|
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 |
配置 |
主题、模块和覆盖
| 模式 | 忽略的内容 |
|---|---|
modules/* |
主题、模块和覆盖 |
override/* |
主题、模块和覆盖 |
themes/*/ |
主题、模块和覆盖 |
!themes/classic |
主题、模块和覆盖 |
!themes/_core |
主题、模块和覆盖 |
!themes/_libraries |
主题、模块和覆盖 |
供应商和依赖项
| 模式 | 忽略的内容 |
|---|---|
bower_components/ |
供应商和依赖项 |
node_modules/ |
Node.js 依赖项 |
composer.phar |
供应商和依赖项 |
php-cs-fixer |
供应商和依赖项 |
.grunt/* |
供应商和依赖项 |
翻译和电子邮件模板
| 模式 | 忽略的内容 |
|---|---|
translations/* |
翻译和电子邮件模板 |
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 |
翻译和电子邮件模板 |
杂项
| 模式 | 忽略的内容 |
|---|---|
*sitemap.xml |
杂项 |
/robots.txt |
杂项 |
Symfony
| 模式 | 忽略的内容 |
|---|---|
/bin/ |
Symfony |
/app/Resources/geoip/GeoLite2-City.mmdb |
Symfony |
/app/Resources/translations/* |
Symfony |
!/app/Resources/translations/default |
Symfony |
/app/config/parameters.yml |
Symfony |
/app/config/parameters.php |
Symfony |
/build/ |
Symfony |
/phpunit.xml |
Symfony |
/var/* |
Symfony |
!/var/cache |
Symfony |
/var/cache/* |
Symfony |
!var/cache/.gitkeep |
Symfony |
!/var/logs |
Symfony |
/var/logs/* |
Symfony |
!var/logs/.gitkeep |
Symfony |
!/var/sessions |
Symfony |
/var/sessions/* |
Symfony |
!var/sessions/.gitkeep |
Symfony |
!var/SymfonyRequirements.php |
Symfony |
/vendor/ |
Symfony |
/web/bundles/ |
Symfony |
如何将此 .gitignore 用于 PrestaShop
- 复制上面的PrestaShop规则,或者直接下载文件。
- 在 Git 仓库根目录创建名为 .gitignore 的文件,并将规则粘贴进去。
- 如果其中一些文件已被跟踪,请运行 git rm -r --cached . 然后再次提交 - Git 仅将忽略规则应用于未跟踪的文件。
- 提交 .gitignore 以便团队中的每个人都共享相同的规则。