.gitignore
tells which files you don't want in the repository. If you do put a file in the repository, then git is going to track it. It's quite contradictory to tell git I don't want to track this file (via .gitignore
), but I also want to track this file (by adding it to the repository).
There are ways to make git
not commit changes to that file on every commit, which is tedious and ugly. My suggestion is to work this out in your head first. Do you or do you not want to track the file? If you do, then all changes to the file will be tracked too.
One option you have is to generate the file via a bootstrap. For example:
# make a backup of the file
$ git mv Swindle-Foundation5/inc.config.php Swindle-Foundation5/inc.config.php-template
# add the file to .gitignore
$ echo "inc.config.php" >> .gitignore
# commit
$ git commit -a
So you basically keep track of a copy of the file, not the file itself. And add a script that generates that file (e.g. bootstrap.bash):
#! /bin/bash
cp Swindle-Foundation5/inc.config.php-template Swindle-Foundation5/inc.config.php
This way, you can update the template in the future, you can also keep it in the repository, but every time you change your actual configuration, they would not be tracked because they belong to a file that is being ignored and is not in the repository.