Create a directory for the new project:
mkdir newproject cd newproject
Initialize for git:
Tell git which types of files to ignore, e.g. compiled Python files:
printf '*.pyc\n*.pyo' >.gitignore
Using filters we can change do keyword expansion during check-out. A filter named kw is defined in ~/.gitconfig:
[filter "kw"] clean = kwclean smudge = kwset
In this case, the scripts kwclean and kwset function like rcs-style keyword expansion. The kwset script looks for the strings $Date$ and $Revision$ and add respectively the commit date and short hash, like this; $Date: 2014-04-01 13:24:45 +0200 $ and $Revision: 206bdb8 $. The kwclean script restores the original strings.
To activate this filter for e.g. Python source code, it has to be set in a file called .gitattributes:
echo "*.py filter=kw" >.gitattributes
Do not enable filtering on binary files such as program executables, pictures such as JPEG and PNG or videos such as MP4! This will most probably screw up the file in question.
Another step that has to be taken is to force checkout of all modified files (or otherwise all files) after a commit. the former is performed by the update-modified-keywords.py script, while the latter is done by the update-all-keywords.py script.
To make use of one of these, the post-commit hook is pointed to one of them:
cd .git/hooks ln -s ~/bin/update-modified-keywords post-commit
Now you can create new files. After than the initial check-in is done:
git add . git commit -m "Initial check-in."