.gitignore 不会忽略文件 [英] .gitignore doesn't ignore files

查看:45
本文介绍了.gitignore 不会忽略文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 .gitignore 文件被忽略,应该忽略的文件仍然可见.

My .gitignore file gets ignored and the files which should be ignored are still visible.

user@host ~/workdir % git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   .htaccess
#       modified:   application/controllers/statistics.php
#
no changes added to commit (use "git add" and/or "git commit -a")
user@host ~/workdir % cat .gitignore
.htaccess
application/config/config.php
application/config/database.php
user@host ~/workdir %

文件在版本控制中,但我不想推送一些合理的更改.git rm ... 不是一个选项,因为文件应该在版本控制中(文件中有其他设置).我只是不想将我的更改推送到这些文件上.

The files are in version control, but with sensible changes I dont want to push. git rm ... is not an option because the files should be in version controll (with other settings in the files). I just dont want to push my changes on this files.

推荐答案

anybug 的步骤在这里记录之后,我的 git 仍然保留跟踪 .htaccess,这有帮助:

after anybug's steps noted here my git still kept track of .htaccess and this helped:

git update-index --assume-unchanged .htaccess

还原:

git update-index --no-assume-unchanged .htaccess

这篇关于.gitignore 不会忽略文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆