简体   繁体   English

.gitignore 和未跟踪的文件显示在 git status 中

[英].gitignore and untracked files are shown in git status

I am getting wierd scenario on Centos 7.5.1804 with git 1.8.3.1.我在使用 git 1.8.3.1 的 Centos 7.5.1804 上遇到了奇怪的情况。 I have .gitignore as我有.gitignore作为

*.pyc

but git status showing followinggit status显示如下

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   a.pyc
#   b.pyc
#   c.pyc
#   d.pyc

Also, those files have never been committed.此外,这些文件从未提交过。 So git status should not have shown those files.所以git status不应该显示这些文件。 What could cause this to happen?什么可能导致这种情况发生?

This was due to a typo in the .gitignore file which had extra space after *.pyc .这是由于 .gitignore 文件中的拼写错误,在*.pyc之后有额外的空间。 However, the behaviour was different on Ubuntu 16.04.5 with git 2.7.但是,使用git 2.7. Ubuntu 16.04.5上的行为有所不同git 2.7. 4 where the files were not listed even with extra space. 4 即使有额外的空间,也没有列出文件。

Probably this space issue has been taken cared between git 1.8.3.1 and 2.7.4 .可能在git 1.8.3.12.7.4之间已经解决了这个空间问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM