Answer the question
In order to leave comments, you need to log in
How to work with gitignore?
I ran into two problems:
1. after adding file names to .gitignore, git status still writes for some reason that these files have changed. The files were present in the repository at the time their names were added to .gitignore. How now to make them ignored by the git?
2. in .gitignore I have the file name config.php. Accordingly, all such files in the current and all subfolders are ignored. How to write correctly so that only the file in the current folder is ignored and the nested ones are not ignored?
Example:
config.php - must be ignored
/path1/config.php - must not be ignored
/path2/config.php - must not be ignored
Answer the question
In order to leave comments, you need to log in
If the file was previously present in the repository, then simply adding it to .gitignore will not lead to anything.
Just run the command
Don't forget the --cached option, without it the config.php file will be deleted from disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question