def restore(path, prefix = '.')
      object = object! path
      prefix = File.expand_path prefix
      FileUtils.mkdir_p prefix unless File.exists? prefix

      file_path = File.join prefix, File.basename(path)

      if object.is_a? Grit::Tree
        FileUtils.mkdir file_path unless File.directory? file_path
        (object.blobs + object.trees).each do |obj|
          restore File.join(path, obj.basename), file_path
        end
      else
        file = File.new file_path, 'w'
        file.write object.data
        file.close
      end
    end
def restore(path, prefix = '.')
      object = object! path
      prefix = File.expand_path prefix
      FileUtils.mkdir_p prefix unless File.exists? prefix

      file_path = File.join prefix, File.basename(path)

      if object.is_a? Grit::Tree
        FileUtils.mkdir file_path unless File.directory? file_path
        (object.blobs + object.trees).each do |obj|
          restore File.join(path, obj.basename), file_path
        end
      else
        file = File.new file_path, 'w'
        file.write object.data
        file.close
      end
    end
Restores a single file or the complete structure of a directory with the
 given path from the repository

 @param [String] path The path of the file or directory to restore from
        the repository
 @param [String] prefix An optional prefix where the file is restored