Skip to content

Instantly share code, notes, and snippets.

@zilongshanren
Created November 20, 2018 06:19
Show Gist options
  • Save zilongshanren/496727a403c954e0bc40d09491d075cb to your computer and use it in GitHub Desktop.
Save zilongshanren/496727a403c954e0bc40d09491d075cb to your computer and use it in GitHub Desktop.
SVN迁移Git
使用 git svn clone 更新仓库,然后使用下面的命令重写commit历史去除大文件。
然后再push到远程仓库。
1. git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | awk '{if($3>524288000) print$1}')" > large-files.txt,将所有大于500M的提交文件列出来
2. cat large-files.txt| awk '{print $2}' | tr '\n' ' ' > large-files-inline.txt
3. git filter-branch -f --prune-empty --index-filter "git rm -rf --cached --ignore-unmatch `cat large-files-inline.txt`" --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment