codem - blog

Archive for the ‘work’ Category

Use Github without using Git (and without really trying)

I’m probably on the outer when it comes to using Git. I find Bzr much easier to use, just as fast and prefer it over Git unless absolutely necessary.

One plus Git has over Bzr is Github which is an awesome solution to sharing code, especially within Open Source projects. Bzr has Launchpad but I’ve often found it slow and cumbersome. Github has presence as well and really makes a good effort to promote sharing of code.

I wanted to use Github to share some of the Open Source libraries and modules we develop but didn’t want to change version control systems to do so. The solution is simple:

  1. Log in to Github
  2. Create a repository – give it a name and description.
  3. Grab the URL to the repo – it will look something like git@github.com:user/repo.git
  4. Ignore the instructions Github gives you, just grab that URL
  5. On your dev machine, switch to the Bzr branch you want to host on Github
  6. Run the command bzr dpush git+ssh://git@github.com/user/repo.git
  7. Wait for a result and that’s it. If you browse to Github page for your repo, you’ll see the source
  8. If you have troubles at step #6 run the command but with a -Derror switch. One common error is to not switch that “:user/repo.git to “/user/repo.git”

The above relies on you having Bzr installed (2.4 is the latest), the bzr-git plugin and also assumes you’ve already set up your SSH keys with Github

Branching from Github is just as easy:

  1. bzr branch git+ssh://git@github.com/user/repo.git feature_directory
  2. hack away
  3. push back to the same branch or a different one

Too easy!

Related to this – check out our new project “DisplayAnything” – an image gallery module for Silverstripe