require 'rubygems' require 'grit' include Grit repo = Repo.new(".git") head = repo.head puts "branch: " + head.name puts "sha: " + head.commit