Last active
December 15, 2015 15:49
-
-
Save FabienArcellier/5284301 to your computer and use it in GitHub Desktop.
This bash snippet is a script to migrate svn repository with a structure (trunk, branches and tags) to a new git repository. It take care of doing authors matching and remove the adress of old svn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This snippet suppose the file authors_list exists | |
# take a look at http://www.yterium.net/Migrer-un-projet-SVN-vers-GIT | |
if [[ "$1" == "" && "$2" == "" ]] ; then | |
echo "$1" | |
echo "$2" | |
echo "Arguments are invalid" | |
exit | |
fi | |
git svn --authors-file=authors_list clone $1 $2 --trunk=trunk --branches=branches --tags=tags | |
cd $2 | |
git filter-branch -f --msg-filter 'sed -e "/git-svn-id:/d"' -- --all | |
#remove historics backups done by the command git filter-branch (I am not sure it's a good pratice) | |
sudo rm -Rf .git/refs/original/refs/ | |
cd .. | |
echo "Migration $2 ended" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
author_list : text file with this format