GitBanner
GitBanner is a lightweight Ruby on Rails engine that displays your current Git branch, last commit hash, date, and message in a discreet banner at the bottom of your app. It works automatically, without modifying your layout, and includes a visual configuration editor.
✨ Features
- 🔍 Shows Git commit info (hash, date, message, branch)
- 🎨 Configurable banner: color, font, size, and more
- ⚙️ Mountless installation – no changes to
config/routes.rbneeded - 🧪 Visual editor at
/git_banner/editorwith live preview - 🔄 Hot-reloads config in development mode
- 🚫 Hidden automatically in production (unless enabled)
📦 Installation
Add the gem to your Gemfile:
gem 'git_banner', path: 'vendor/git_banner_0.3.4' # Or use from RubyGems
Then run:
bundle install
🚀 Usage
Start your Rails server:
rails s
Visit your app and scroll to the bottom. You’ll see the Git banner injected automatically before </body>, with the current Git commit info.
🎛 Configuration
To customize the banner, visit:
/git_banner/editor
You can configure:
- Background and text colors
- Font family and size
- Environments where the banner should appear (e.g.
development,staging) - Enable or disable in production
The settings are stored in:
config/git_banner_settings.json
Changes are applied live in development mode.
🧠 How It Works
- Automatically reads
.gitinfo using pure Ruby (git rev-parse,git log, etc.) - Injects an HTML banner into the rendered body
- No layout modification required
- Lightweight and non-intrusive
📁 File locations
lib/git_banner/config.rb→ Handles settingslib/git_banner/git_info.rb→ Extracts git dataapp/views/git_banner/editor.erb→ Configuration formlib/git_banner/railtie.rb→ Mounts the engine and injects HTML
🧑💻 Author
Govani Sanchez Orduña
https://soyprogramador.liz.mx
📄 License
This project is licensed under the MIT License.