Git with Subversion for WordPress Plugin Development Detailed Guide Explains How To Use Git like GitHub, your Mac and WordPress to Keep Plugins Updated. This is Fully Command Line Based Guide. We are using OS X 10.9.1 while writing this guide. Git with Subversion for WordPress Plugin Development Detailed Guide is quite important as this keeps our development in three places – your Mac, Git like GitHub (or your own server with Git). Usually we only use local computer as backup copy for ongoing development, but adding Git in the middle has the basic advantage of having another copy at hand on the server. It was great if WordPress directly used Git, but till date, SVN is used.
Git with Subversion for WordPress Plugin Development : Needed Stuffs
It is impossible to go with the basic details – it will make this guide too lengthy. Just to say what we are using for this Git with Subversion for WordPress Plugin Development Detailed Guide. We are using HomeBrew Package manager with iTerm2. (You can see the setup here). Practically things has not been changed since Mark Jaquith wrote the guide – Developing on WordPress using Git. git svn <argument> itself a command. You just need to update and upgrade HomeBrew, install SVN and Git via HomeBrew – they will normally rightly work on OS X Mavericks. Te error with
git svn rebase which disturbed before has been fixed by HomeBrew now.
Git with Subversion for WordPress Plugin Development : The Whole Thing
It is quite pathetic to work with SVN on Mac than Git. We are assuming that you have a WordPress Plugin and a GitHub Account. Normally, we are always on our user named folder on Terminal/iTerm2, so we will create a directory first – named like wp-plugins or something. This is to keep the future Plugin developments easier.
So, create the folder :
Now get the last revision number by using this command :
svn log http://plugins.svn.wordpress.org/ftp-to-zip/
ftp-to-zip is our Plugin’s name, you must replace with your own Plugin’s name. You will get output and lot of numbers with your commit comments. Get the last one and run this command :
git svn clone --no-minimize-url -s -r583286 http://plugins.svn.wordpress.org/ftp-to-zip/
Change the r583286 and ftp-to-zip with your own data. You will get terminal output like “Initialized empty Git repository in…”. Great. Change directory to the folder now :
Now run this command :
GIT_TRACE=2 git svn fetch
There will be huge terminal output running for long time! You need not not read them! It will stop, for example at 583286 in our case. We need to move the SVN HEAD into our Git master :
git svn rebase
All files will appear on your local computer, that is Mac now. You can open the location using Finder. We tell this cheatsheet everytime working with any kind of Git. Basically this is a sort of cheating – we can change the things from GUI.
Now, in case of any wrong things with SVN, in case you added any SVN url wrong, you can fix it by removal :
git config --remove-section svn-remote.svn
This command is only for correcting mistake – not a part of this guide.
Now, create a new GitHub repository with the same name (for making the things easy) from browser, i.e. web UI. There is video in the linked guide.
You will ultimately land in a webpage in GitHub saying “Create a new repository on the command line” and the commands :
git add README.md
git commit -m "first commit"
git remote add origin email@example.com:AbhishekGhosh/ftp-to-zip.git
git push -u origin master
Normally, your needed commands will be there, there is nothing to think with these lines of commands here. Now, actually we will change some files and normally push it to GitHub, with usual Git Commands like:
git commit -am "Vomiting like a blind, Everything sucks, really"
You can merge, you can do anything you want towards Github – its working in the middle. Copy-pasting readme.txt to README.md will work fine for the easy to read part. Now to commit the changes towards WordPress, you need two commands :
git svn rebase
git svn dcommit
git svn rebase command does not work, try (in excerpt format, in this way) :
git svn clone -s -r583286 https://plugins.svn.wordpress.org/ftp-to-zip/
git remote add -f github git://github.com/AbhishekGhosh/ftp-to-zip.git
git merge github/master
git svn dcommit