未跟踪的文件仍显示为git状态 [英] untracked files still appear in git status

查看:78
本文介绍了未跟踪的文件仍显示为git状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用.git/info/exclude取消了某些文件夹和文件的跟踪:

I have untracked some folders and files by using .git/info/exclude :

doc
*.txt
doc/*.txt
doc/somefile.txt

但是git status表示仍在跟踪中:

But git status says it is still tracked :

$ git st
# On branch dev
# 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:   doc/somefile.txt

其他奇怪的事情是ls-files显示它未被跟踪:

Other weird thing is that ls-files shows it is untracked :

$ git ls-files --ignored --exclude-from=.git/info/exclude
doc/somefile.txt
$ touch /tmp/xxx
$ git ls-files --ignored --exclude-from=/tmp/xxx
$

我使用的是git版本1.8.1.5

I am on git version 1.8.1.5

所以我得出结论,我可能会误解或做错事情.有什么想法吗?

So I conclude I may misunderstand something or do something wrong. Any idea please ?

推荐答案

由于您是在本地忽略存储库中的文件,因此需要告诉git您正在忽略它们

Since you are locally ignoring files that are in the repository, you need to tell git that you are ignoring them

git update-index --assume-unchanged <files to forget>

这篇关于未跟踪的文件仍显示为git状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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