branch="$(git rev-parse --abbrev-ref HEAD)" if [ "$branch" = "main" ]; then echo "You can't commit directly to main - please check out a branch." exit 1 fi # Detect if running on Windows and use npx.cmd, otherwise use npx if [ "$OS" = "Windows_NT" ]; then npx_cmd="npx.cmd" else npx_cmd="npx" fi "$npx_cmd" lint-staged