JJ.
JJ.

Reputation: 5084

Why does git keep deleting my folder?

I have a folder in my repository called 'activity'. It keeps getting strangely deleted from the repository, and isn't seen as an untracked file.

In github, it is rendered as a folder with a green arrow, and the text '→ f32111b' next to it. This has happened several times now, and only with this one folder.

I've already checked .gitignore. Is there another reason why a folder called 'activity' would be trouble in git?

Upvotes: 6

Views: 3422

Answers (3)

Jörg W Mittag
Jörg W Mittag

Reputation: 369458

That's not a directory, that's a submodule. Or at least GitHub seems to think so.

What does your .gitmodules file look like? Did you maybe forget to run git submodule init and git submodule update?

Submodules can be a little bit tricky, especially when you convert from a directory to a submodule or back.

Upvotes: 12

Mark van Lent
Mark van Lent

Reputation: 13001

In addition to the answer madlep gave (git doesn't tracks empty directories):

http://git.or.cz/gitwiki/GitFaq#CanIaddemptydirectories.3F:

That is, directories never have to be added to the repository, and are not tracked on their own.

Upvotes: 1

madlep
madlep

Reputation: 49676

Is the directory empty?

Git doesn't track empty dirs.

The hack trick is to touch an empty file in there if you really need to keep the directory kicking around.

Upvotes: 5

Related Questions