```bash
#!/bin/bash
# ワークツリーのルートに移動
if ! cd "$(git rev-parse --show-toplevel)"; then
echo "cd error"
exit 1
fi
branch=$(git rev-parse --abbrev-ref HEAD)
# shellcheck disable=SC2063
ancestor_branch=$(git show-branch | grep '*' | grep -v "${branch}" | head -1 | awk -F'[]~^[]' '{print $2}')
if git rev-parse --verify origin/"${branch}" >/dev/null 2>&1; then
# originにブランチが存在する場合
from=$(git merge-base HEAD origin/"${branch}")
else
# 新しいブランチの場合
from=${ancestor_branch}
fi
# 影響ファイルに`target/`からはじまるモノがあった場合だけ実行
if git diff --name-only "${from}".."${branch}" | grep -Eq "^target/"; then
# lint処理を実行しNGなら終了
if ! task lint; then
echo "Linting failed. Aborting push."
exit 1
fi
fi
exit 0
```