We’re just starting to use GIT at Defensio and although there are plenty of great resources like the Peepcode video and Jean-François Couture’s blog, the learning curve (from SVN) can be a little rough. The problem is that GIT is very powerful, and probably too powerful for a small shop like ours. This unfortunately leads to some complexity that we’d rather not have to deal with, especially since we don’t need all the fancy features.
In an effort to simplify our workflow, we started to build a few scripts that automate complex tasks. My plan is to post them on my blog for your own benefit. If they’re useful for us, they should be useful for other people too.
The first script I’m posting is git-remote-branch. It is meant to simplify the process of creating and deleting remote and local tracking branches. Instead of having to execute multiple commands, easy to remember one-liners are now enough. (hey! we’re lazy!)
Check this out:
[source:php]git-remote-branch create experimental[/source]
This command creates an experimental branch on a remote server (‘origin’ by default) from the one you’re currently sitting in, then a local tracking branch. When that’s done, it checks out to the newly created local branch. You can then pull and push as you wish.
[source:php]git-remote-branch create experimental origin2[/source]
This command does the same as the previous one, but creates experimental on ‘origin2’ instead of ‘origin’.
When you’re done dealing with the remote/local branch combo you created, you can delete both in one go:
[source:php]git-remote-branch delete experimental[/source]
The script will delete the remote branch, then check out “master” if you’re still sitting in “experimental”. The local “experimental” branch is then deleted.
git-remote-branch can be downloaded here. Make sure to chmod +x it before executing it. For the record, it’s written in Ruby. Let me know if it’s useful for you!