Skip to content

Instantly share code, notes, and snippets.

@isidromerayo
Created February 18, 2013 20:02
Show Gist options
  • Save isidromerayo/4980196 to your computer and use it in GitHub Desktop.
Save isidromerayo/4980196 to your computer and use it in GitHub Desktop.
[remote "all"]
url = https://github.com/isidromerayo/simple_php_skeleton.git
url = https://bitbucket.org/isidromerayo/skeleton_php_project.git
# fetch = +refs/heads/*:refs/remotes/origin/*
@isidromerayo
Copy link
Author

http://eikke.com/importing-a-git-tree-into-a-subversion-repository/index.html

$ git svn dcommit
Unable to determine upstream SVN information from HEAD history.
Perhaps the repository is empty. at /opt/local/libexec/git-core/git-svn line 439.

This fails since the git svn command can’t figure out which commits to push: there’s no link between our original Git repository and the Subversion heads.

To fix this, we can use a Git graft to link them. We’ll tell Git the commit which created the SVN folder in which we want to store the project is the parent commit of the first commit in our Git repository:

$ git show-ref trunk
741ab63aea786882eafd38dc74369e651f554c9c refs/remotes/trunk
$ git log --pretty=oneline master | tail -n1
88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 Initial version
$ echo "88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 741ab63aea786882eafd38dc74369e651f554c9c" >> .git/info/grafts

If now you execute git log, you’ll see the “Create repository structure” SVN commit is displayed after our “Initial version” commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment