Skip to content

Instantly share code, notes, and snippets.

@fujimura
Created October 3, 2016 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujimura/855b58449a7b45176df085907f171b78 to your computer and use it in GitHub Desktop.
Save fujimura/855b58449a7b45176df085907f171b78 to your computer and use it in GitHub Desktop.
Script to make a pull request with the result from rubocop --auto-correct
bundle exec rubocop --auto-correct $(git ls-files | grep -E -v "^(db|bin)" | grep "\.rb$") || true
git diff --exit-code && exit 0
git add .
timestamp=`date +'%Y%m%d%H%M'`
commit_comment="rubocop --auto-correct $timestamp"
git commit -m "$commit_comment"
git checkout -b rubocop-auto-correct-$timestamp
branch_name=`git name-rev --name-only HEAD`
git push -u origin $branch_name
hub pull-request -m "$commit_comment" -h proper-inc:$branch_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment