Question

I have a middleman project : A bunch of config files, a source directory, and a build directory, like so :

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

On my server, I have a http root, say /var/www/html/project/.

So I manage a git repository at /var/www/html/project.git/

There is a /var/www/html/project.git/hooks/post-receive that says :

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

So when I push, files are being copied to the http root. But only the build directory is relevant. I don't want config.rb, or the source directory, to be copied in the http root ; How can I tell git to ignore some files during execution of the the post-receive hook ?

Was it helpful?

Solution

Just give the the path that has to be checked out:

git checkout -f -- build
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top