filter-branch to remove extra directory

后端 未结 2 649
深忆病人
深忆病人 2020-12-10 14:49

I\'m migrating several Subversion repositories to Git, but they were set up a bit weird: the standard trunk/branches/tags structure lives within several subdirectories of th

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 15:08

    Figured it out based on a comment here. It seems to be an issue with how git-svn represents "empty" (directory-only) commits. It works fine if I start at a normal commit:

    git filter-branch --index-filter \
        'git ls-files -s | sed "s-/trunk/-/-" |
            GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
                git update-index --index-info &&
         mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' 83df928c..HEAD
    

提交回复
热议问题