在页面中显示当前分支的名称

1. 可以在Helper (app/helpers/applicationHelper) 中添加如下代码 

class ApplicationHelper
  def branch_info
    branch_name = `git rev-parse --abbrev-ref HEAD`

    content_tag :span, branch_name, :class => "label label-warning"
  end
end

2. 创建新的页面 (app/views/shared/_git_branch_info.haml)

.git-branch-info
  = branch_info

3. 是否加载分支名称 - View (app/view/layout/application.haml)

- if Rails.env.development?
  = render 'shared/git_branch_info', handlers: [:haml]