GitHub Tips: Removing a Remote Branch

April 28, 2008

If you are working on a branch and want to abandon it, what do you do?

It’s easy to remove it from your local repository:

$ git branch -d mybranch # delete branch "mybranch"

And then how do you remove it from a GitHub repository? This works:

$ git push<my_account>/<my_repository>.git :heads/<mybranch>

But there’s an easier way. Scott Chacon suggests:

You can also do (assuming ‘origin’ is the name of your remote):

git push origin :mybranch

Scott Chacon is the author of the Git Internals book from Peepcode.


Getting Started With Git and GitHub Hosting

April 13, 2008

The most popular revision control system for an open source Rails app is Git.

I installed Git using MacPorts with
sudo port install git-core.

After installing Git, I installed the Git bundle for TextMate.

I signed up for Git hosting at GitHub. The process is nearly self-explanatory but I consulted two tutorials, A Tutorial Introduction to Git and Setting up a new Rails app with Git. I discovered I needed to create an ssh public/private key pair on my local machine and add the public key to my GitHub profile before I could push the app to the GitHub repository.

I’ve found two screencasts about using Git wih Rails, from PeepCode and Using Git to Manage and Deploy your Rails Apps from Scott Chacon.

GitHub has their own Git Guides but the best instructions I’ve found for using Git are the Git Guides from the Insoshi open source project.

Subversion or Git: Which Likes Me More?

April 13, 2008

I start any project with a revision control system. On projects of any complexity, I know you absolutely need the ability to make notes about what you’ve changed every time you make an improvement. And you need the ability to roll back to an earlier version when your improvements weren’t improvements. You also get the bonus of off-site backup of your code (assuming you use one of the many no-cost or low-cost repository hosting services).

A few years ago, the only alternative to proprietary revision control systems was the open source CVS. On occasions, it could make grown-ups cry. Subversion (SVN) has become more popular recently and it’s widely used on both open source and closed projects.

If I’m doing a project just for myself or my minions (that is, with a single point of ultimate authority), svn is the best choice. There’s nothing extra needed when you want to use svn on Mac OS X version 10.5 (Leopard); it is included when you install the Developer Tools package. You’ll just need to sign up for a repository hosting service.

For an open source project, there are good reasons to prefer Git, as detailed here by Dr Nic Williams. Git is the distributed revision control system created by Linus Torvalds (the creator of Linux). The most popular choice for a Git repository hosting service is GitHub.