简体   繁体   English

如何将git master分支推送到新SVN存储库的trunk

[英]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 我在Git存储库中有一个Wordpress插件: https://github.com/pushpad/pushpad-wordpresshttps://github.com/pushpad/pushpad-wordpress

I would like to continue to use git for development. 我想继续使用git进行开发。 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/ 但是我必须向SVN发布一个副本才能在Wordpress.org上发布该插件: https://plugins.svn.wordpress.org/pushpad-web-push-notifications/https://plugins.svn.wordpress.org/pushpad-web-push-notifications/

I'm looking for the easiest solution possibile. 我正在寻找最简单的解决方案。 The SVN repository is empty. SVN存储库为空。 I cannot use git svn clone because I don't want to create a new git repo. 我不能使用git svn clone因为我不想创建一个新的git repo。

I would like to simply push the git master branch to SVN trunk. 我想简单地将git master分支推送到SVN trunk。 How can I do that? 我怎样才能做到这一点?

I've tried adding the following code to .git/config 我已经尝试将以下代码添加到.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. 然而,当我运行git svn fetch svn git开始搜索数百万个修订版,这些修订版引用了Wordpress.org托管的所有插件。 So I have to kill that command. 所以我必须杀死那个命令。 Also git branch -a doesn't show any new branch for svn. 另外git branch -a没有显示svn的任何新分支。 So I don't know how to proceed. 所以我不知道该怎么做。

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远程的git配置中的代码应该与此类似:

[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 一旦执行git svn init,该远程会自动添加,该url必须完整,而不仅仅是服务器根目录

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 其中-r540813是您的第一个修订版, https://plugins.svn.wordpress.org/wp-agenda/ -r540813是Wordpress中插件SVN存储库的示例

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 第一个修订号将显示在控制台输出的最后一次提交中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM