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?
T开发者_开发百科hanks, 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 won't commit empty directories. There must be files in the directories first.
Create an empty .gitignore
file inside the empty folder that you would like to commit.
Git will only track Files and the changes in them. So folders are tracked as part of the file changes in them. In order to create an empty folder and commit it, there have to be some files inside it.
You can add any file you want, if you don't have any files to put there, I would suggest using an empty .gitignore
file. This will have no effect on your repo as long as it's empty
精彩评论