3

I have a project that uses git for its source control and I use SmartGit as the GUI.

Recently when adding new files to the project they're being ignored by git (this has only started happening in the last week or so before that it was fine).

So if I add a new file into the hierarchy it doesn't show up in the SmartGit GUI.

If I type git status into git then nothing comes up.

If I type git status --ignored into git then it lists the file I had added.

If I type git add -f filename then it adds the file and it shows up in SmartGit.

I've checked my .gitignore file and it has nothing unusual in it.

I don't have a global .gitignore. I do have an exclude file but it is referencing a subdirectory and had been working fine long before this problem showed up.

Any ideas why git should think all new files are ignored even when they aren't referenced in a .gitignore file?

Mixit Deejay
  • 41
  • 1
  • 3

2 Answers2

4

I don't know how and when , but in my case I had the whole directory added to .gitignore. Use:

git check-ignore -v path

To check for ignored files and directories. More info at: Git is ignoring files that aren't in gitignore

tec
  • 999
  • 3
  • 18
  • 40
1

That's the intended behaviour. New files are untracked by git unless and until you use 'git add' which will bring them into version control.

If you create several new files, you can add them all with:

git add -A

anything that's covered by a .gitignore entry will be excluded.

meatballs
  • 3,917
  • 1
  • 15
  • 19
  • 4
    Thanks for the reply but when I add new files they are not listed as untracked they are listed as ignored. So the command 'git status --ignored' lists the files, but the command 'git status' lists nothing. If they were untracked then 'git status' would list the files as untracked. – Mixit Deejay Mar 03 '14 at 16:47