What do `pre-receive` and `update` hooks do and how do they differ?
AdvancedConceptHooks, submodules, LFS and signing
Answer
Both run on the server during push. pre-receive runs once for the whole push and gets all ref updates on stdin (old new ref); rejecting stops everything. update runs once per ref and receives the ref and SHAs as arguments, so it can reject branches individually. Hosted GitHub does not allow custom hooks except on GitHub Enterprise Server, which is why rulesets are used.
More on Hooks, submodules, LFS and signing
What are Git hooks and where do they live?BeginnerHow do you share hooks with a team, given `.git/hooks` is not committed?IntermediateWhat does the `commit-msg` hook receive and what is it good for?IntermediateWhat is a Git submodule?BeginnerWhy do submodules confuse people and what are the common pitfalls?IntermediateSubmodules versus subtrees versus a monorepo: how do you choose?Advanced