在 Subversion 下存储空目录的 .gitignore 文件
正如这个问题中提到的(在 Git 常见问题解答中),您不能在 Git 中存储空目录。
我有一个 git-svn 克隆,我想在其中使用 Git 来处理我项目的 Subversion 存储库。
问题是 Subversion 下存储了一些空目录,这些目录是编译项目所必需的。
到目前为止,我一直在按照常见问题解答中的建议进行操作:我在每个目录中添加了一个 .gitignore
文件,该文件应保持为空,并将该添加提交到 Git,因此每当我从该 < code>git-svn 存储库,我得到所有空目录并且可以编译。
小问题是,每当我想将 git svn dcommit 回 Subversion 存储库时,我需要从一个单独的 Git 分支执行此操作,而无需提交所有 .gitignore 的内容。 > 文件被添加,这样它们就不会被添加到 Subversion 中。
但我想了一下,它可能并没有那么糟糕 - 所以我的问题是,有什么理由我不应该将每个空目录的 .gitignore
文件添加到 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 I 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于还没有其他人添加答案“否”,我将添加一个:) 应该没问题 - Subversion 不会以任何特殊方式处理名为
.gitignore
的文件。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.我不明白为什么你必须做任何事情。当你 git svn clone 时,它会为你创建空目录,除非你想添加或删除空目录,否则你可以像平常一样使用 git 。唯一会出现问题的是,如果你想为你的 git svn 克隆创建一个纯 git 克隆。由于 git 有本地分支,因此通常没有必要,但如果由于某种原因有必要,我认为最简单的方法是通过执行常规文件系统副本来制作“克隆”。
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.