tags:

views:

83

answers:

2

Hi!

I have a stupid problem... however I read the great git tutorial here, I'm unable to create directories.

My folder structure is:

Code - Python - C++ - F# - ...

From within a initialised local repository "Code" I changed into the subfolders "Python", "C++", ... did git init and now I want the same structure on my versioning server.

% git commit -m "added directories"
# On branch master
nothing to commit (working directory clean)

I guess I got something completely wrong, did I?

Thanks, wishi

+4  A: 

Git won't commit empty directories. There must be files in the directories first.

Marc W
Thanks man!! ;)
wishi
+3  A: 

Try to add some files to directories first. You can add some dummy file to directory, and remove that file when you have added the actual content for the directory.

Git does not track empty directories, it tracks files and their contents.

git init
mkdir foo
touch foo/dummy_empty_file

git add foo
git add foo/dummy_empty_file
git commit -m "adding files"
Juha Syrjälä
'`.gitignore`' works well for that (or a dummy '`.keepme`').
Jakub Narębski
You only need one of the two adds here. When given a directory, `git-add` recursively adds it. On the other hand, adding the only file in the directory is the same as adding the entire directory, since as you say, git tracks files and their contents.
Jefromi