首页 文章

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

提问于
浏览
5

我正在使用大型svn存储库(30,000个修订版) . 我使用git-svn但收效甚微 .

我的主要问题是svn存储库包含对大型二进制文件(~30MB)的频繁更新 . 我不关心这些文件的历史,但我关心这些文件的当前版本 .

如果自我上一次svn rebase(这是常见的)以来对大型二进制文件进行了多次更新,git svn rebase的运行速度非常慢 . 我的git数据库也快速增长 . 我想解决这两个关键问题 .

理想情况下,我想要做的是完全忽略svn中的这些大文件,然后运行一个脚本,该脚本只获取最新版本,然后我将使用我的.gitignore阻止它 . 我对其他选择非常开放 .

3 回答

  • 10

    您可以使用 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)"
    
  • 0

    据我所知,我认为不可能使用git-svn这样做,因为git-svn获取整个svn信息并将其转换为git . 检查你的包文件,你会发现它是一个巨大的文件 .

    我要做的是将巨大的文件/文件夹添加到.gitignore,以便它根本不会处理它们 .

    一个很好的解决方案发布在这里:http://alblue.bandlem.com/2011/11/git-tip-of-week-git-bigjobbies.html

  • 0

    git svn选项--ignore-paths =

    在将svn存储库转换为git时排除不需要的二进制文件很有用

    如果您知道二进制文件的文件扩展名,那么您可以编写一个正则表达式来排除它们,例如,

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

相关问题