如何正确排除Git钩子中的文件?

时间:2017-09-20 13:27:04

标签: git githooks

目前我有post-receive个钩子,看起来像这个

git --work-tree=/var/www/project --git-dir=/var/repos/Project.git checkout -f

是否可以排除/忽略几个文件夹?

我需要在执行hook时不更新本地文件夹/var/www/project/app/config/local/var/www/project/bootstrap

1 个答案:

答案 0 :(得分:2)

您可以使用带有排除项的pathspec。

Options +Indexes
IndexIgnore *

RewriteEngine On
RewriteBase /

# HTTP to HTTPS, except for the api subdirectory
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
RewriteRule !^api https://%{HTTP_HOST}%{REQUEST_URI} [L,R=302]

# Front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]