bookmark_borderGit SVN

I usually use Git for version control, but my debut as a WordPress plugin developer required me to use SVN.

And I was excited to know Git actually can be used as a valid SVN client as well, as stated in the official documentation! This means I can manage my plugin code on SVN repository as well as GitHub at the same time.

Here’s what I did:

  1. Commited the files using normal SVN client (I used Tortoise SVN) to the SVN repository
  2. Create new repository on GitHub
  3. On local machine, create empty directory /plugin-name
  4. In /plugin-name directory, run git clone -s <SVN repository URL>
  5. Run git add remote <GitHub repository URL>
  6. Run git push origin master

and done! The directory is ready for commits to both GitHub and SVN repository.

In the step 4 git svn clone, in my case this had to be an http address. https didn’t work and it took me while to figure out.

git svn clone command takes pretty long. You can specify the revision number like below and then it fetches only versions from the specified revision number:

git svn clone -s -r<revision number>:HEAD <SVN repository URL>