2

Say I have .gitignore:

x64/
x86/
bin/
obj/
FileA
FileB
FileC
etc..

Now when I build, all build files that I want to ignore, are actually being ignored. However, the build fails for a missing file (Call it FileX).

When I add FileX to the project, it builds fine with no errors. However, GIT does not see that I added that file, and when I do git status --ignored, I see the file under untracked files.

I tried the solution in undo git assume unchanged with no success.

Why this file is being ignored and I did not add it to .gitignore?

Sandra K
  • 1,209
  • 1
  • 10
  • 21
  • 2
    Possible duplicate of [Explain which gitignore rule is ignoring my file](https://stackoverflow.com/questions/12144633/explain-which-gitignore-rule-is-ignoring-my-file) – phd Jul 15 '18 at 17:43

1 Answers1

5

To make sure why this file is being ignored, type:

git check-ignore -v -- path/to/FileX

You will see the actual .gitignore file responsible for its current ignored state.
If the output of that command is empty, that means the file is simply untracked, ready to be added.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Briliant! The name of FileX had `lib` in it, and I added `**lib` into my .gitignore in order to ignore everything that goes under LIB directories – Sandra K Jul 15 '18 at 15:58
  • 1
    @SandraK Why not `lib/` to ignore the content of a folder named `lib`? – VonC Jul 15 '18 at 15:59
  • `git: 'check-ignore' is not a git command. See 'git --help'.` – cnst Jul 15 '18 at 15:59
  • 1
    @cnst It is (https://git-scm.com/docs/git-check-ignore) since Git 1.8.2 (https://stackoverflow.com/a/23928523/6309). Sept 2013: https://stackoverflow.com/a/18953923/6309 – VonC Jul 15 '18 at 16:00