How can I show the git branch of a rails application in this application?

I have several different branches of the rails application working in the development environment on the same server (in separate databases, obv), and I would like to clearly indicate which branch is displayed when I hit the application via the Internet.

Any ideas that don't execute git-branchor git-symbolic-ref HEADin reverse cycles and parsing output?

+3
source share
2 answers

Check out Grit , it allows you to read the Git repository using Ruby.

repository = Grit::Repo.new(RAILS_ROOT)
repository.head.name # => "master"
+5
source

Actually, as you suggested, shelling is the right thing.

, - git , .git/HEAD.

0

Source: https://habr.com/ru/post/1715211/


All Articles