[英]How can I show the git branch of a rails app within that app?
I've got a couple of different branches of a rails app running in a development environment on the same server (on separate databases, obv), and I'd like to make it very clear what branch is being shown when I hit the app through the web. 我在同一台服务器(在不同的数据库,obv)上的开发环境中运行了一个rails应用程序的几个不同分支,我想清楚地说明当我点击应用程序时显示的分支是什么通过网络。
Any ideas, short of running git-branch
or git-symbolic-ref HEAD
in backticks and parsing the output? 任何想法,缺少在反引号中运行
git-branch
或git-symbolic-ref HEAD
并解析输出?
Actually, as you suggested, shelling out is the right thing to do. 实际上,正如你的建议,炮轰是正确的。
If you're afraid somehow git
might not be available to the app, you might try reading the file .git/HEAD
. 如果您害怕应用程序可能无法使用
git
,您可以尝试阅读.git/HEAD
文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.