Skip to content

Instantly share code, notes, and snippets.

@benstiglitz
Created September 12, 2011 17:58
Show Gist options
  • Save benstiglitz/1211929 to your computer and use it in GitHub Desktop.
Save benstiglitz/1211929 to your computer and use it in GitHub Desktop.
Pulling one repository into a subtree of another and pushing to SVN.
git remote add -f tp file:///Volumes/Sources/tp.git/
INITIAL_COMMIT=`git rev-list tp/master --reverse | head -n1`
git checkout -b nb-merge
for MCH in `git rev-list --reverse $INITIAL_COMMIT..tp/master`
do
git merge --squash -s subtree --no-commit $MCH && git commit -C $MCH
done
git filter-branch --msg-filter "sed 's/^/[new-branch] /'" master..HEAD
git svn branch new-branch -m "[new-branch] Creating branch."
git rebase refs/remotes/new-branch
git svn dcommit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment