简体   繁体   English

git-svn忽略大型二进制文件

[英]git-svn ignore large binary files

I'm working with a large svn repository (30,000+ revisions). 我正在使用大型svn存储库(30,000多个版本)。 I am using git-svn with limited success. 我使用git-svn但收效甚微。

My major problem is that the svn repository contains frequent updates to large binary files (~30MB). 我的主要问题是svn存储库包含对大型二进制文件(~30MB)的频繁更新。 I do not care about the history of these files but I do care about the current versions of these files. 我不关心这些文件的历史,但我关心这些文件的当前版本。

git svn rebase runs very slowly if there have been multiple updates to the large binary files since my last svn rebase (which is common). 如果自我上一次svn rebase(这是常见的)以来对大型二进制文件进行了多次更新,git svn rebase的运行速度非常慢。 My git database also grows very quickly. 我的git数据库也快速增长。 I'm looking to resolve these two key issues. 我想解决这两个关键问题。

Ideally, what I would like to do is completely ignore these large files from svn and then run a script that fetches only the latest version which I would then block with my .gitignore. 理想情况下,我想要做的是完全忽略svn中的这些大文件,然后运行一个脚本,该脚本只获取最新版本,然后我将使用我的.gitignore阻止它。 I'm very open to other options though. 我对其他选择非常开放。

you can ignore some files using the --ignore-paths option of git svn : 你可以使用git svn--ignore-paths选项忽略一些文件:

 --ignore-paths=<regex>
               This allows one to specify a Perl regular expression that will
               cause skipping of all matching paths from checkout from SVN.
               The --ignore-paths option should match for every fetch
               (including automatic fetches due to clone, dcommit, rebase,
               etc) on a given repository.

                   config key: svn-remote.<name>.ignore-paths

               If the ignore-paths config key is set and the command line
               option is also given, both regular expressions will be used.

               Examples:

               Skip "doc*" directory for every fetch

                       --ignore-paths="^doc"

               Skip "branches" and "tags" of first level directories

                       --ignore-paths="^[^/]+/(?:branches|tags)"

From what i know i don't think its possible to do so using git-svn since git-svn fetch the whole svn info and convert it to git. 据我所知,我认为不可能使用git-svn这样做,因为git-svn获取整个svn信息并将其转换为git。 check your pack file and you will see that its a huge file. 检查你的包文件,你会发现它是一个巨大的文件。

what i would do is adding the huge files/folder to the .gitignore so it will not process them at all. 我要做的是将巨大的文件/文件夹添加到.gitignore,以便它根本不会处理它们。

A nice solution is published here: http://alblue.bandlem.com/2011/11/git-tip-of-week-git-bigjobbies.html 这里发布了一个很好的解决方案: http//alblue.bandlem.com/2011/11/git-tip-of-week-git-bigjobbies.html

git svn option --ignore-paths= git svn选项--ignore-paths =

is useful to exclude unwanted binary files when converting svn repository to git 在将svn存储库转换为git时排除不需要的二进制文件很有用

If you know the filename extensions of the binary files then you can write a regex expression to exclude them, FOR EXAMPLE, 如果您知道二进制文件的文件扩展名,那么您可以编写一个正则表达式来排除它们,例如,

.jar files:--ignore-paths=".*.jar$" .jar文件: - ignore-paths =“。*。jar $”

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

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