Answer the question
In order to leave comments, you need to log in
.gitignore and tracked files
It so happened that the site config is stored in the repository, and if any changes are made to it (for example, adding routes), then the local version of the site stops working for other programmers, since the connection parameters to the database are different for everyone.
As a solution, I tried to add it to .gitignore, but when I commit, the config is still displayed in the list of modified files. Is it possible to somehow prevent tracking changes in the config without removing it from the repository?
Answer the question
In order to leave comments, you need to log in
You can temporarily ignore changes in the file with the command: git update-index --assume-unchanged <file>
Disabled with the command: git update-index --no-assume-unchanged <file>
You need to remove it from the index:
git rm --cached path/to/file
It's just that it's already in the repository. do a git rm and it won't update anymore.
You must have made a mistake when adding it to .gitignore, otherwise it would not appear in the list of modified files. If you show how you did it, maybe they can help you here.
We have several levels of inherited configs in our project. Those that are used by each developer are prefixed with local. These files are added to .gitignore. Templates for local configs are stored in the repository with the sample extension. The same local configs are convenient for staging.
You can make the congig.local.php file add it to .gitignore and at the bottom of inc.config.php write something like
if (is_file($local_config = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'congig.local.php'))
include $local_config;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question