Storing .gitignore files for empty directories under Subversion
As mentioned in this question (and in the Git FAQ), you can't store empty directories in Git.
I have a git-svn
clone, and I want to use Git in it to work against my project's Subversion repository.
The problem is that there are some empty directories that are stored under Subversion and are necessary for compiling the project.
So far, I've been doing what was suggested in the FAQ: I added a .gitignore
file in each directory that should stay empty, and committed that addition to Git, so whenever 开发者_如何学CI clone from this git-svn
repository, I get all the empty directories and I can compile.
The minor trouble is that whenever I want to git svn dcommit
back to the Subversion repository, I need to do that from a separate Git branch without the commit in which all the .gitignore
files were added, so that they don't get added to Subversion as well.
But I thought about it, and it might not be that bad - so my questions is, is there any reason why I should not commit the addition of the .gitignore
files for each empty directory to Subversion?
Since no one else has added the answer "No" yet, I'll add one :) That should be fine - Subversion doesn't treat files called .gitignore
in any special way.
I don't understand why you have to do anything. When you git svn clone
it creates the empty directories for you, and unless you want to add or remove empty directories, you can just use git as normal. The only time it would be a problem is if you want to make a pure git clone of your git svn clone. Since git has local branches, that's usually not necessary, but if it were necessary for some reason, I think the easiest thing would be to make your "clone" by doing a regular file-system copy.
精彩评论