2

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?

Shashwat Kumar
  • 5,159
  • 2
  • 30
  • 66

1 Answers1

1

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.

Shashwat Kumar
  • 5,159
  • 2
  • 30
  • 66
  • Note that the [current documentation](https://git-scm.com/docs/gitignore) mentions it: `Trailing spaces are ignored unless they are quoted with backslash ("\").` – choroba Jun 16 '19 at 09:12