Introduction
Sometimes you want to check your code or run tests before sending it to a shared place. A pre-push hook is a small script that runs automatically before your code is pushed. It helps catch problems early and keeps the shared code safe.
When you want to run tests automatically before pushing code to avoid breaking the shared project.
When you want to check code style or formatting before sending your changes.
When you want to prevent pushing secrets or sensitive data by mistake.
When you want to remind yourself or your team to update documentation before pushing.
When you want to block pushes if certain conditions are not met, like commit message format.