tag - how to add folder to git repository




How to commit a directory into a git repository? (2)

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

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


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"




git