Git Track File Existance Only, Not File Contents
git, gitignore
Solution
A native way to do this (beside git-annex) is to:
- track a file template
- version a script which is able, on checkout, to generate the file from the file template (if the file doesn't exist yet): that file won't be versioned and will remain private. The script knows how to generate that file or from where to copy it.
- declare in a `.gitattribute` file a content filter driver: a `smudge` script which will run automatically on checkout and will reference the script mentioned in the previous point.
(image from "Customizing Git Attributes" " from the Git Book)
Problem
Is there any way to tell Git to track a file's existence, but not to track the content of the file? I would like Git to create a file if it doesn't already exist when git pull is run, but to otherwise ignore the file. This would be highly useful for error_logs ect in a web-app I am developing.