For users familiar with the Git hook system, Bitbucket Server provides a way for plugin developers to create their own hooks that can be installed and managed without having to touch the filesystem.
Hooks have been implemented using familiar modules within the Atlassian plugin system. Bitbucket Server also provides repository hooks which are easier to implement for simple use cases.
Currently there are three types of hooks that are available in Bitbucket Server.
Pre-receive Hook Modules are used to potentially block pushes to Bitbucket Server. An example might be to stop deletion of branches or limit force-pushes to personal branches. Pre-receive hooks do not fire when a pull-request is merged - for that, you may also want to implement a repository merge-check.
Post-receive Hook Modules are invoked after a push or merge has taken place. An example might be to notify a build server, such as Bamboo, that there are new commits on a branch to be built.
Asynchronous post-receive hooks are preferred when there is no need to return any information to the client, as they are triggered after the push is complete. This is a better experience for the user as they will not have to wait for potentially slow operations.
Merge Check Modules are used to block pull requests from being merged until a required set of conditions have been met. An example might be that all reviewers must accept the request, or that any associated builds are green.