Reputation: 1375
I already have a svn read only repo checked out (svn co and not git svn). I have made some changes and commits using git which is then pushed up to github.
At this point, git does not have all of the history from svn. I was wondering if there was a way to extract and import this at this point.
The various git-svn guides show how to import a clean repo and transfer the history but not one that I can find that is already in use.
Upvotes: 7
Views: 2854
Reputation: 1329692
To complete Thilo's good answer, once you have imported the svn repo into a git one, you can add that git repository into yours with a script as detailed in merging in unrelated git branches
#!/bin/bash
set -e
if test -z "$2" -o -n "$3"; then
echo "usage: $0 REPO BRANCHNAME" >&2
exit 1
fi
repo=$1
branch=$2
git fetch "$repo" "$branch"
head=$(git rev-parse HEAD)
fetched=$(git rev-parse FETCH_HEAD)
headref=$(git rev-parse --symbolic-full-name HEAD)
git checkout $fetched .
tree=$(git write-tree)
newhead=$(echo "merged in branch '$branch' from $repo" | git commit-tree $tree -p $head -p $fetched)
git-update-ref $headref $newhead $head
git reset --hard $headref
Other methods includes:
git pull REPO BRANCH
Upvotes: 8