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.
When moving to Git from another version control system like Subversion (SVN), we generally recommend that you perform a "tip migration", which migrates just the latest version of the repository contents, without including history.
git-svn is a specialized tool for Git users to interact with Git repositories. It works by providing a Git frontend to an SVN backend. With git-svn, you use Git commands on the local repository, so it's just like using normal Git. However, behind the scenes, the relevant SVN commands are sent to the server.
Many people prefer Git for version control for a few reasons: It's faster to commit. Because you commit to the central repository more often in SVN, network traffic slows everyone down. Whereas with Git, you're working mostly on your local repository and only committing to the central repository every so often.
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
You will probably have to do an svn import into a fresh git repository, merge the two repositories (just add them together, it will probably complain about them being unrelated) and then rebase the changes you made unto the imported history.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With