我有以下.gitignore文件
# file named .gitignore
system/application/config/database.php
system/application/config/config.php
system/logs
modules/recaptcha/config/*
Run Code Online (Sandbox Code Playgroud)
但是,当我在config和recapcha.php中添加任何更改时,git status警告我如下.当我向database.php添加任何更改时.它没有显示它的状态
shin@shin-Latitude-E5420:/var/www/myapp$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# 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: modules/recaptcha/config/recaptcha.php
# modified: system/application/config/config.php
#
no changes added to commit (use "git add" and/or "git commit -a")
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
提前致谢.
我在Ubuntu 11.04上使用git版本1.7.5.1
Dip*_*tch 100
这些文件已存储在本地提交树中.您需要将它们从存储库中删除,这可以通过以下方式完成,git rm --cached system/application/config/config.php modules/recaptcha/config/recaptcha.php
之后您需要再进行一次提交并继续使用它.
Nan*_*pal 29
执行以下操作以触发gitignore
步骤1: 在您要修复的存储库中提交所有待处理的更改,然后进行推送。
步骤2: 现在,您需要从git索引中删除所有内容,以刷新git存储库。这很安全。使用以下命令:
git rm -r --cached .
Run Code Online (Sandbox Code Playgroud)
步骤3: 现在您需要将所有内容重新添加到仓库中,这可以使用以下命令完成:
git add .
Run Code Online (Sandbox Code Playgroud)
步骤4: 最后,您需要使用以下命令来提交这些更改:
git commit -m "Gitignore issue fixed"
Run Code Online (Sandbox Code Playgroud)
如果您的文件已经在git中,然后将目录添加到.gitignore,git将继续跟踪它.如果您不想要它,请先执行"git rm"将其删除.
归档时间: |
|
查看次数: |
43699 次 |
最近记录: |