Here's a brief explanation of each hook:
+--------------------+
| Pre-Commit Hook |
+--------------------+
|
v
+--------------------+
| Commit-Msg Hook |
+--------------------+
|
v
+--------------------+
| Commit Hook |
+--------------------+
|
v
+--------------------+
| Pre-Rebase Hook |
+--------------------+
|
v
+-------------------------------+
| Rebase |
| (Pre-Rebase, |
| Post-Rebase Hooks) |
+-------------------------------+
|
v
+--------------------+
| Post-Rebase Hook |
+--------------------+
|
v
+--------------------+
| Pre-Receive Hook |
+--------------------+
|
v
+--------------------+
| Update Hook |
+--------------------+
|
v
+--------------------+
| Post-Receive Hook|
+--------------------+
|
v
+--------------------+
| Post-Commit Hook |
+--------------------+
|
v
+--------------------+
| Post-Merge Hook |
+--------------------+
The commit-msg hook runs after the commit message has been entered and before the commit is recorded. This hook can be used to validate the commit message format, enforce commit message conventions, or perform any other checks or modifications related to the commit message.
The commit-msg hook receives the path to the temporary file containing the commit message as an argument. If the script exits with a non-zero status, the commit operation will be aborted.
Pre-Commit Hook: Runs before you commit any changes to the local repository. It can be used to validate the commit message, check code style, run tests, etc.
Commit Hook: Runs after the commit data has been committed to the local repository. It can be used for tasks like updating a commit message template or firing a deployment script.
Pre-Rebase Hook: Runs before a rebase operation starts. It can be used for tasks like stopping the rebase if certain conditions are met.
Rebase Hooks: Several hooks are available during the rebase operation:
pre-rebase: Runs before the rebase operation starts.
post-rebase: Runs after the rebase operation completes successfully.
Post-Rebase Hook: Runs after a successful rebase operation.
Pre-Receive Hook: Runs on the remote repository before any references are updated by the git push command. It can be used to enforce repository policies.
Update Hook: Runs on the remote repository after the references have been updated by the git push command. It can be used to update external systems or triggers.
Post-Receive Hook: Runs on the remote repository after the references have been updated by the git push command. It can be used for deployment scripts or notifications.
Post-Commit Hook: Runs after a successful commit operation.
Post-Merge Hook: Runs after a successful merge operation.
Top comments (0)