I haven't used Subversion in years, and while I have done a lot of WordPress plugins over the year for work, they were all private and we never shared them on the registry.
I prefer to use git. I knew it had a svn sub-command however I've never used it. I spent the better part of a day trying to figure out how to push to WordPress's Subversion from git.
I tried to follow several guides but I kept getting Unable to determine upstream SVN information from working tree history, I spent hours googling it, eventually I came to the conclusion I have to use a different branch.
I thought I'd share this. might save someone few hours of frustration.
Notes :
- I'm not sure how this would work if multiple people are pushing to svn, I'd use git and only one person pushes to svn.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
--> git init ooo-nospam/ Initialized empty Git repository in /tmp/ooo-nospam/.git/ --> cd ooo-nospam # The --no-minimize-url --stdlayout options are *VERT* important --> git svn init --no-minimize-url --stdlayout --prefix=wp-svn/ https://plugins.svn.wordpress.org/oneofones-nospam/ --> git remote add github git@github.com:OneOfOne/ooo-nospam.git --> git remote update github Fetching github --> git pull github master # Create an empty orphan bracnh to be used by svn-only --> git checkout --orphan svn # Clean all the files from the master branch --> git rm -rf . rm 'README.md' rm 'ooo-nospam.php' rm 'readme.txt' # Find out the earlist revision to use for our clone, usually it's the assets one |---> svn ls -v https://plugins.svn.wordpress.org/oneofones-nospam/ 887507 OneOfOne Apr 04 15:10 ./ 887134 plugin-m Apr 04 02:52 assets/ #note the 887134 887134 plugin-m Apr 04 02:52 branches/ 887507 OneOfOne Apr 04 15:10 tags/ 887475 OneOfOne Apr 04 13:31 trunk/ --> git svn fetch -r 887134:HEAD --all r887134 = 25565f9dd1f11e52d3ea6eb6892577385e053ae4 (refs/remotes/wp-svn/trunk) A readme.txt A ooo-nospam.php .............more stuff............. Checked out HEAD: https://plugins.svn.wordpress.org/oneofones-nospam/trunk r887475 # Switch back to git master --> git checkout master |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# edit / add / delete files, for example : --> date > new.txt --> git add . --> git commit -a -m "It is new!" [master 493365d] It is new! 4 files changed, 1 insertion(+), 213 deletions(-) delete mode 100644 README.md create mode 100644 new.txt delete mode 100644 ooo-nospam.php delete mode 100644 readme.txt # Push to github if you want --> git push github #Switch to our svn branch --> git checkout svn # Pull the changes from master --> git checkout master . # Add any new files. --> git add . --> git commit -a -m git-updates [svn e91232c] git-update 1 file changed, 1 insertion(+) create mode 100644 new.txt # Fix any comflicts, although there should never be any . --> git svn rebase Current branch svn is up to date. # Commit to svn, note that you have to pass your username for committing. --> git svn dcommit --username OneOfOne -v Committing to https://plugins.svn.wordpress.org/oneofones-nospam/trunk ... diff-tree e91232cf1d61b694f36709c2b8c6971dec185a91~1 e91232cf1d61b694f36709c2b8c6971dec185a91 # Tag it if you want : |---> git svn tag v0.4 --username OneOfOne Copying https://plugins.svn.wordpress.org/oneofones-nospam/trunk at r887475 to https://plugins.svn.wordpress.org/oneofones-nospam/tags/v0.4... Found possible branch point: https://plugins.svn.wordpress.org/oneofones-nospam/trunk => https://plugins.svn.wordpress.org/oneofones-nospam/tags/v0.4, 887475 Found branch parent: (refs/remotes/svn/tags/v0.4) edaa96ad25a9a5a51b555a91edd8263386ecf8b5 Following parent with do_switch Successfully followed parent r887507 = b975bda0cc34e00cd0a530c52dfff612e22f4faf (refs/remotes/svn/tags/v0.4) |