Dustin Rohde
Dustin Rohde

Reputation: 23

Why can't I track these files with git?

My Github repository: https://github.com/dustinrohde/crystals/tree/xp/test

It's normally very simple to add files to my working tree:

git add path/to/file1 path/to/file2 ...
git commit

But for some reason, I can't get git to recognize directories "test/res-invalid-noimage" and "test/res-invalid-noworld". I know that it's a problem with git and not with github because I searched for the files in gitk and found them not, even after repeated attempts to add them. When I just added the two directories and issued a commit, git told me that no changes had been added.

Questions and answers are welcome.

EDIT: Although the directories contain no files, just empty directories, they are used by the test suite, so I need them to exist in the working tree.

Upvotes: 1

Views: 963

Answers (3)

Warpzit
Warpzit

Reputation: 28162

If you should happen to have copied another git project and you still have the .git folder from the other project inside the folder which you want to track. Then you wont be able to track the folder before you remove the old .git folder.

(Ye someone might do something stupid like that, I did)

Upvotes: 1

Daniel Kurka
Daniel Kurka

Reputation: 7985

You can not add empty directories to a git repository.

If you need the directories to be added you have to place some kind of file in them.

Upvotes: 0

Lily Ballard
Lily Ballard

Reputation: 185751

Are these empty directories? Git cannot track empty directories. In fact, it doesn't track directories at all; git only tracks files.

Upvotes: 3

Related Questions