How does the 'pre-receive' Git Hook differ from the 'post-receive' Hook?

  • They both trigger before and after receiving data
  • 'pre-receive' runs before updates are accepted, and 'post-receive' runs after updates are accepted
  • 'pre-receive' runs after updates are accepted, and 'post-receive' runs before updates are accepted
  • 'pre-receive' runs only for specific branches, 'post-receive' runs for all branches
The 'pre-receive' hook is invoked before any references are updated, allowing rejection of updates. In contrast, 'post-receive' is invoked after all refs have been updated, making it useful for triggering actions after the update. Understanding their timing is crucial for implementing custom Git workflows.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *