Complete the code to create a pre-push hook script that runs before pushing.
#!/bin/sh [1]
The pre-push hook script runs commands before pushing. Using echo shows a message.
Complete the code to make the pre-push hook stop the push if tests fail.
#!/bin/sh if ! [1]; then echo "Tests failed, push aborted." exit 1 fi
The hook runs make test to check tests. If tests fail, it stops the push.
Fix the error in the pre-push hook to correctly check for staged changes.
#!/bin/sh if git diff --quiet [1]; then echo "No staged changes." else echo "Staged changes found. Push aborted." exit 1 fi
The --cached option checks for staged changes. Without it, git diff --quiet checks unstaged changes.
Fill both blanks to create a pre-push hook that runs tests and lints code before pushing.
#!/bin/sh if ! [1]; then echo "Tests failed. Push aborted." exit 1 fi if ! [2]; then echo "Lint errors found. Push aborted." exit 1 fi
The hook runs npm test to check tests and npm run lint to check code style before pushing.
Fill all three blanks to create a pre-push hook that checks tests, lint, and code formatting.
#!/bin/sh if ! [1]; then echo "Tests failed. Push aborted." exit 1 fi if ! [2]; then echo "Lint errors found. Push aborted." exit 1 fi if ! [3]; then echo "Code formatting issues. Push aborted." exit 1 fi
The hook runs tests, linting, and formatting checks using npm test, npm run lint, and npm run format:check.