How to push git master branch to trunk of a new SVN repository

I have a WordPress plugin in a Git repository: https://github.com/pushpad/pushpad-wordpress

I would like to continue to use git for development. However I have to publish a copy to SVN in order to publish the plugin on WordPress.org:
https://plugins.svn.wordpress.org/pushpad-web-push-notifications/

Read More

I’m looking for the easiest solution possibile. The SVN repository is empty. I cannot use git svn clone because I don’t want to create a new git repo.

I would like to simply push the git master branch to SVN trunk. How can I do that?

I’ve tried adding the following code to .git/config

[svn-remote "svn"]  
    url = https://plugins.svn.wordpress.org
    fetch = pushpad-web-push-notifications/trunk:refs/remotes/trunk
    branches = pushpad-web-push-notifications/branches/*:refs/remotes/*
    tags = pushpad-web-push-notifications/tags/*:refs/remotes/tags/*

However when I run git svn fetch svn git starts searching millions of revisions which refer to all the plugins hosted by WordPress.org. So I have to kill that command. Also git branch -a doesn’t show any new branch for svn. So I don’t know how to proceed.

Related posts

2 comments

  1. there u go.

    git svn init <linkToRepositoryOrFolder>
    git svn dcommit
    

    the code in the git config for the svn remote should then be something similar to this:

    [svn-remote "svn"]
    url = http://mySVN/wordpresspluginrepository
    fetch = :refs/remotes/git-svn
    

    that remote is automatically added once you execute git svn init, the url has to be complete, not just the server root

  2. You have to execute:

    git svn clone -r540813:HEAD -s --no-minimize-url https://plugins.svn.wordpress.org/wp-agenda/
    

    Where -r540813 is your first revision and https://plugins.svn.wordpress.org/wp-agenda/ is a example of a plugin SVN repository at WordPress

    To get the first revision number, you can use:

    git svn log https://plugins.svn.wordpress.org/wp-agenda/
    

    And the first revision number will be displayed in the last commit on the console output

Comments are closed.