我有一个全新的git仓库,刚刚检出。然后我更新了我的.gitignore
文件,添加了以下内容:
wp-config.php
现在我的git status
显示如下:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
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)
我添加并提交了这个文件(本地)。然后我更新wp-config.php
文件。
但是,现在,当我运行git status
时,我得到以下结果:
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
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
我已经阅读了这个问题:.gitignore is not working,但是其中的观点似乎并不适用于我正在使用的全新版本库。是否还有其他建议?我肯定不必将其提交到远程('origin/master')以在本地忽略它吧?
git add -f wp-config.php
),因为这将覆盖.gitignore
。 - Willem Van Onsem