简体   繁体   English

当使用git和git-svn网桥时,如何指示svn中要忽略的文件?

[英]How can you indicate files to ignore in svn when using git and the git-svn bridge?

There is a master subversion repository that I've cloned a git repo from. 我已经从中克隆了一个git repo的主版本库。 I've got a lot of ignored files in my .gitignore that I'd like the svn repository to know about. 我的gitignore文件中有很多我想让svn存储库了解的文件。

I know that I can use git svn show-ignore to pull the ignored list from subversion, but how can I do the reverse? 我知道我可以使用git svn show-ignore从Subversion中提取被忽略的列表,但是我该如何做相反的事情呢? Send a list of files to be ignored back to the svn repo? 将要忽略的文件列表发送回svn repo?

Git version (and git-svn is at the same version): Git版本(和git-svn是同一版本):

git --version 
git version 1.7.0.5

Ok, so one (annoying) method that I've found is to: 好的,所以我发现的一种(烦人的)方法是:

(convenience step) add the gitignore file to the repository so that it is tracked. (便捷步骤)将gitignore文件添加到存储库中,以便对其进行跟踪。

Do an svn checkout . 进行svn checkout

svn propedit svn:ignore ./

Add in all the stuff that's in the tracked gitignore file. 添加跟踪的gitignore文件中的所有内容。

This is pretty ugly, though, and who likes to actually touch & checkout svn when you're working with git? 但是,这非常丑陋,当您使用git时,谁愿意真正触摸并检出svn? Anyone have a better alternative? 有人有更好的选择吗?

Git svn does not support this, so you'd have to do it yourself on a separate svn checkout. Git svn不支持此功能,因此您必须自己在单独的svn结帐中进行操作。 From the manual: 从手册中:

We ignore all SVN properties except svn:executable 我们忽略除svn:executable之外的所有SVN属性

It would be really nice though if this wasn't the answer... 如果这不是答案,那真是太好了……

Yes, it is possible. 对的,这是可能的。 Just install SubGit into your SVN repository. 只需将SubGit安装到您的SVN存储库中即可。 It acts like a concurrent-safe bridge and performs bidirectional translation (triggered by hooks). 它的作用类似于并发安全网桥,并执行双向转换(由挂钩触发)。 It translates SVN tags to Git tags, branches to branches, svn:ignores to .gitignore, svn:eol-style to "eol" and "text" attribute of .gitattirbutes, fully merged SVN branches to Git merge-commits; 它将SVN标签转换为Git标签,将分支转换为分支,将svn:ignores转换为.gitignore,将svn:eol-style转换为“ eol”,并将.gitattirbutes的“ text”属性,将完全合并的SVN分支转换为Git合并提交; and vice versa. 反之亦然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM