【问题标题】:how to ignore files after commit in post-receive git?如何在 post-receive git 中提交后忽略文件?
【发布时间】:2012-03-12 04:45:05
【问题描述】:

我有一个中间人项目:一堆配置文件、一个源目录和一个构建目录,如下所示:

project/
  build/
   index.html
  source/
   _index.haml
 config.rb
 Gemfile
 WhatNot

在我的服务器上,我有一个 http 根目录,例如 /var/www/html/project/。

所以我在 /var/www/html/project.git/ 管理一个 git 存储库

有一个 /var/www/html/project.git/hooks/post-receive 说:

GIT_WORK_TREE=/var/www/html/project git checkout -f

所以当我推送时,文件被复制到 http 根目录。但只有构建目录是相关的。我不希望将 config.rb 或源目录复制到 http root 中;如何告诉 git 在执行 post-receive 钩子期间忽略某些文件?

【问题讨论】:

    标签: git middleman


    【解决方案1】:

    只需给出必须签出的路径:

    git checkout -f -- build
    

    【讨论】:

      猜你喜欢
      • 2018-06-18
      • 1970-01-01
      • 2019-03-19
      • 2015-12-30
      • 2013-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-27
      相关资源
      最近更新 更多