質問が不合理に見えるかもしれませんが、疑問があります。私はgitの専門家ではありませんが、コマンドラインを使って毎日5年間使っていますので、かなり慣れています。ここでGitignore:私は変更をコミットするはずですか?
は私が解決することはできませんシナリオです:
- 鉱山の貴重な同僚が、WordPressのプロジェクトを開始しました。彼はレポのすべての単一のファイルをコミット...悪い考え。
- 私は今プロジェクトに来て、プロジェクトをクローンします(私のインデックスはきれいです)。まず、.gitignoreファイルにいくつかのエントリを追加してコミットします。これらのルールでは、私は "wp-config.php"、各インスタンス(local/preprod/prod)で変更される通常のWP設定ファイルを追加しました。簡単です。
しかし、私は私の地元の設定で、この特定のファイル、変更:
[email protected]$ vi wp-config.php [email protected]$ 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")
なぜ彼はそれをやっているの?なぜ彼は私のファイルを無視していないのですか?ない(私たちはそれを行うことができますが、その後、我々は、ファイルの削除をコミットする必要があり、削除済みとインデックスは、ファイルをスポッティングされる原因と確か
git rm -r --cached wp-config.php
: は、いくつかの読みになった後、私はいくつかの仲間は次のように、ファイルの削除を行うことを見ました物理的に)。 gitリポジトリ内の既存のファイルを無視するのが標準的な方法ですか?
ご協力ありがとうございます。
# 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
この回答を見るhttps://stackoverflow.com/a/20241145/6330106 'git update-index --skip-worktree'も同様の効果があります。 '--no-skip-wortree'または' --no-assume-unchanged'は、変更を追跡したいときに効果をキャンセルします。 –
ElpieKay
[Gitは、追跡されたが現在は.gitignoreにあるファイルについて "忘れる"の可能性があります(https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about) – phd