.gitignore不会忽略`git status`中的文件名和空格 [英] .gitignore not ignoring filenames with spaces in them on `git status`

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

问题描述

 #修改:COM / config / Config / Edit Project Settings.lnk 

但是在我的.gitignore中我有:

  *。lnk 

这里发生了什么?这可能是一个空白的问题吗?

解决方案

好,所以我的问题实际上是已经在存储库中的文件, .gitignore 的模式并不妨碍git跟踪他们的变化。



需要的是

>

git update-index --assume-unchanged



除非assh0l指出git处理空格完美。


When I do a git status I get:

#       modified:   COM/config/Config/Edit Project Settings.lnk

But in my .gitignore I have:

*.lnk

What is going on here? Could it be a problem with whitespaces?

解决方案

Ok so my problem actually was that the files where already in the repository, so adding the pattern to .gitignore did not prevent git from tracking changes on them.

What was needed was

git update-index --assume-unchanged <file>

Now their changes are not tracked anymore.

Else as ansh0l pointed out git handles spaces perfectly fine.

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

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