Subscribe

Inform and Act

Read our official statements regarding recent executive orders and find resources to help you take action. Learn more

GHC (Haskell) Moving to Git

The Haskell guys got together, evaluated the options, and decided Git was the best choice.

It came down to two things: the degree of support available, and
flexibility of the tools (git is much happier to let you modify the history
than Mercurial). Speed ruled out bzr, and Windows support is less of an
issue: git appears to work reasonably well on Windows these days.

Check out the GHC mirror on GitHub to follow along. Score one more for the good guys.

A Git deployment workflow

Bryan Helmkamp of weplay has published his team's Git deployment workflow over on his blog. It includes a bunch of Rake tasks which we've Gist'd for your convenience.

# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow

module GitCommands
  extend self

  def diff_staging
    `git fetch`
    puts `git diff origin/production origin/staging`
  end

  def tag_staging(branch_name)
    verify_working_directory_clean

    `git fetch`
    `git branch -f staging origin/staging`
    `git checkout staging`
    `git reset --hard origin/#{branch_name}`
    `git push -f origin staging`
    `git checkout master`
    `git branch -D staging`
  end

  def tag_producton
    verify_working_directory_clean

    `git fetch`
    `git branch -f production origin/production`
    `git checkout production`
    `git reset --hard origin/staging`
    `git push -f origin production`
    `git checkout master`
    `git branch -D production`
  end

  def branch_production(branch_name)
    verify_working_directory_clean

    `git fetch`
    `git branch -f production origin/production`
    `git checkout production`
    `git branch #{branch_name}`
    `git checkout #{branch_name}`
    `git push origin #{branch_name}`
  end

protected

  def verify_working_directory_clean
    return if `git status` =~ /working directory clean/
    raise "Must have clean working directory"
  end
end


namespace :tag do
  desc <<-DESC
    Update the staging branch to prepare for a staging deploy.
    Defaults to master. Optionally specify a BRANCH=name
  DESC

  task :staging do
    branch_name = ENV['BRANCH'] || "master"
    GitCommands.tag_staging(branch_name)
  end

  desc "Update the remove production branch to prepare for a release"
  task :production => ['diff:staging'] do
    GitCommands.tag_production
  end
end

namespace :diff do
  desc "Show the differences between the staging branch and the production branch"
  task :staging do
    GitCommands.diff_staging
  end
end

namespace :branch do
  desc "Branch from production for tweaks or bug fixs. Specify BRANCH=name"
  task :production do
    branch_name = ENV['BRANCH']
    raise "You must specify a branch name using BRANCH=name" unless branch_name
    GitCommands.branch_production
  end
end

namespace :deploy do
  desc "Tag and deploy staging"
  task :staging => "tag:staging" do
    `cap staging deploy:long`
  end
end

Maven-enabled project hosting

mrdon has an excellent blog post explaining how to use GitHub with Maven. Not just read-only, either – mrdon’s solution handles pushing the git repository changes to GitHub transparently.

The post closes with a choice quote, too:

I’m convinced forks are a good thing for the software development community, especially if there is a solid means in place to track such forks in such a way that both parties benefit.

(Hat tip to myabc)

The Post-Apocalyptic Guide

Worried about GitHub going down? Host not found errors in the middle of your deploy? Fear not! guitsaru" has written a guide on what to do When GitHub Goes Bad.

Currently covered:

  • What if my GitHub repository is corrupted or deleted?
  • How can I share my repository if GitHub goes down?
  • How do I deploy my application when GitHub is down?

Getting Real

A post I wrote about applying 37signals’ Getting Real to GitHub is up on their product blog:

How GitHub used Getting Real to pick a fight, scratch their own itch, and stay lean.

Upcoming Speaking Gigs

In the next month I will be keynoting the Ruby Hoedown (August 8-9) and speaking at erubycon (August 15-17). If you’re at either of these events stop by and say hi.

Interested in having someone from GitHub talk at your conference about Git, distributed source control, the future, or the history of Temüjin’s conquests? Email chris@logicalawesome.com.

New to Git?

Know someone new to Git? Here are some awesome resources to start with:

  • GitCasts – Short and sweet screencasts on a variety of Git topics

Update: Added ‘Git for designers.’

Intro to Gist Video

bryanl has posted a video explaining Gist. Check it out!


BryanL demos Gist: A Super Hot Pastebin from Bryan Liles on Vimeo.

Easy Peezy Capistrano Deployment

The guys over at EdgeCase have written up a guide on Easier Capistrano Deployments from GitHub. It explains how to setup and use the :forward_agent option when you deploy. Nice!

Dashboard Widget

The stand up fellas over at New Leaders have created a GitHub Dashboard Widget for OS X. Check it out – very slick!

Fork You Sighting #2

(Thanks mathie!)

Supercharged Vim Theme

You TextMate users already have a GitHub theme, but now us Vimiacs can join the fun.

Grab the theme right here. Thanks Bruno!

Visual Cheat Sheet

Even if you’re a Git master, Zack Rusin’s Git Cheat Sheet may prove useful. It’s got a whole lotta commands ready for cheatin’.

Thanks Zack!

Gitsplosion! in iTunes

As damon points out, Gitsplosion! is now on the iTunes store. You can get to it via this link or by searching for ‘GitHub’ in the iTunes store.

Sweet.

git-remote-branch

If you aren’t using the GitHub gem, then perhaps webmat’s git_remote_branch may interest you. The aim of the micro-project can best be summed up with a quote:

I believe the commands for the simple scenario can be simpler.

Check out the blog post for more information on what git_remote_branch does and how it can help.