Configure hook execution with Bundler via `gemfile`
mainTo enforce specific versions of Overcommit or other gems used in hooks, use the gemfile option in .overcommit.yml.
Performance Tip: Loading a large project Gemfile adds startup delay. It is recommended to create a dedicated, minimal Gemfile (e.g., .overcommit_gems.rb) containing only the gems required for your hooks.
- Create
.overcommit_gems.rbin your root. - Run
bundle install --gemfile=.overcommit_gems.rb. - Commit both
.overcommit_gems.rband.overcommit_gems.rb.lock. - Set the
gemfileoption in.overcommit.ymlto.overcommit_gems.rb.
bundle install --gemfile=.overcommit_gems.rb