The question may seem absurd but I have a doubt. I'm not a git expert but I've use it every day for 5 years via the command-line so I'm pretty used to it.
Here is the scenario I can't solve:
- A valuable colleague of mine started a WordPress project. He commited every single file in the repo... bad idea.
- I come on the project now, clone the project (so my index is super clean). I start by adding few entries in the .gitignore file and commit it. In these rules, i have added "wp-config.php", the regular WP config file, which will change on each instance (local/preprod/prod). Easy.
But then I change this specific file, with my local config:
me@myproject$ vi wp-config.php me@myproject$ git st On branch develop Your branch is up-to-date with 'origin/develop'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: wp-config.php no changes added to commit (use "git add" and/or "git commit -a")
Why is he doing that? Why isn't he ignoring my files? After few reading, I saw that some fellows does a file deletion, like :
git rm -r --cached wp-config.php
Sure we can do that but then we have to commit the file deletion, cause the index is spotting the file as deleted (not physically ofc). Is it the standard way to ignore an existing file in a git repo?
Thanks for your helps.
Here is a copy of my .gitignore file:
# Ignore all logs files.
*.log
# Ignore the instance-based configuration.
wp-config.php
# Ignore cache, backups and uploaded files.
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php
wp-content/plugins/hello.php
# Ignore some site-based root files.
/.htaccess
/sitemap.xml
/sitemap.xml.gz
# Ignore editor files.
.idea
# Ignore OS generated files.
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db