Using git for WordPress development
git is a powerful revision control system. It is a distributed system. This means that you can commit, create branches or tags on your local hard drive without any network connection. Read more about git on the project's website, there's also great documentation there.
If you write WordPress plugins and want them to be published on the WordPress plugins page you have to use svn which can be painful once you're used to git.
Fortunately, git can interact with svn via git-svn. Here's a list of the commands you will need to use.
git svn init -s http://svn.wp-plugins.org/your_plugin
This will initialize a local git repository. Inside the repository, use
svn log http://svn.wp-plugins.org/your_plugin
The svn command lists the svn revisions. You want to write down the number of the latest commit. Then,
git svn fetch -rNNNNNN git gc git branch -a
Replace NNNNNN with the appropriate revision number from the svn output. The first command will fetch the svn trunk. The second command cleans up your git repository. The last command will list all branches, local and remote.
Notice: If you get the error fatal: refs/remotes/trunk: not a valid SHA1 you probably tried to check out a revistion that was a tag. This seems to be a bug in git svn (confirmed up to 18.104.22.168). The workaround is to fetch the previous revision, one that is not a tag.
A normal workflow could look like this:
... edit ... git commit -m "Added awesome new feature" -a git svn dcommit
The last command will update the remote svn trunk. As we're talking about WordPress plugins you'll want to tag your commit so that older versions of your plugin can still be downloaded.
git svn tag version
This will create the tag in the remote svn repository. It looks like this is only possible since git 1.6.1. For Debian Lenny systems you'll need git from backports.org for this to work.This should get you started with git and WordPress plugin development. Please do read the git documentation for more details.