Created
August 22, 2013 20:42
-
-
Save Toady00/6312528 to your computer and use it in GitHub Desktop.
Process for grafting svn commits to git repo after cloning with the --no-metadata option.
This file contains 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
# This assumes you prefixed all the svn branches with 'svn/' via the | |
# --prefix=svn/ option when you performed the initial clone. Otherwise | |
# replace 'svn/trunk' with the name of your branch that corresponds to | |
# trunk. | |
git svn fetch --revision [start_revision_number]:[end_revision_number] | |
GRAFT_PARENT_GIT=`git log --pretty=format:'%H' -1 master | |
GRAFT_FIRST_SVN=`git log --pretty=format:'%H' svn/trunk | tail -n` # or whatever you called your trunk | |
echo $GRAFT_PARENT_GIT $GRAFT_FIRST_SVN > .git/info/grafts | |
git checkout master | |
git merge svn/trunk --ff-only # I like to use fast forward only in case the master has diverged from trunk. This is optional |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment