I am using git for big web application. At my local end I want to make few files unchanged during work flow of git. For example there is database and config files which have different content as compare to live server. I don't want to let files over written by any of git command. how I can lock or ignore config and database files
Asked
Active
Viewed 87 times
0
-
possible duplicate of [Committing Machine Specific Configuration Files](http://stackoverflow.com/questions/1396617/committing-machine-specific-configuration-files) – Senseful Sep 03 '14 at 19:32
2 Answers
6
Use the .gitignore file for this. Such files like database configurations or folders with changing files should not be included in the git repository.
In most cases you can create a template file like
database_config.txt_template
and commit that file in your git repo. When a new user install that project he can rename the file and can change the settings.

René Höhle
- 26,716
- 22
- 73
- 82
1
You can't lock file.
Instead, you can create an example-file (so you have a base config file) and copy it at the right place.
git mv path/to/config path/to/config-example
echo "path/to/config" >>.gitignore
cp path/to/config-example path/to/config

Asenar
- 6,732
- 3
- 36
- 49