Running Rubocop on commit, changes, or branch

Tagged branch, git, rubocop  Languages 
  • To RuboCop the current commit
git diff-tree --no-commit-id --name-only -r HEAD --diff-filter AMT | xargs bundle exec rubocop
  • To RuboCop the working tree changes
git diff --name-only --diff-filter AMT | xargs bundle exec rubocop
  • To RuboCop all of the changes from the branch
git diff --name-only master --diff-filter AMT | xargs bundle exec rubocop

From https://about.gitlab.com/handbook/tools-and-tips/rubocop/

Also see: