简体   繁体   中英

.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. I have .gitignore as

*.pyc

but git status showing following

$ 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. What could cause this to happen?

This was due to a typo in the .gitignore file which had extra space after *.pyc . However, the behaviour was different on Ubuntu 16.04.5 with git 2.7. 4 where the files were not listed even with extra space.

Probably this space issue has been taken cared between git 1.8.3.1 and 2.7.4 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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