Git svn clone: How to defer fetch of revision history

前端 未结 3 1979
忘了有多久
忘了有多久 2020-12-13 09:42

I often have the case that I want to work on a SVN repository right away. But an ordinary git svn clone [url] also clones the entire history. So I want to speed

3条回答
  •  庸人自扰
    2020-12-13 10:29

    I found out how it can be done. The trick is not to use git svn clone. Instead, use git svn init and git svn fetch individually. Modified the example:

    URL=http://google-web-toolkit.googlecode.com/svn/trunk/
    REV=`svn info $URL |grep Revision: | awk '{print $2}'`
    PROJECT_FOLDER=google-web-toolkit-readonly
    
    mkdir $PROJECT_FOLDER
    cd !$ #goes into dir named $PROJECT_FOLDER
    git svn init -s $URL #-s implies --stdlayout with /trunk /tags /branches
    git svn fetch -r $REV
    
    # hack, hack, hack
    
    # or update history (fetch 50 revisions back each loop
    for (( r=$REV; r>0; r-=50 )); 
    do 
      git svn fetch -r $r:HEAD
    done
    

提交回复
热议问题