Usage
- Michael Rüegg
- Caroline Trink (Unlicensed)
Configuration
The configuration for Pull Request Please can be found in the repository settings right under the menu item "Hooks".
The first step is to enable the hook for Pull Request Please (note that you cannot enable the hook without a valid license for the add-on). After that, a window appears where you can specify the options for Pull Request Please :
Pull Request Please allows to protect Git branch and tag references from pushes without a pull request through the following two options:
- Specific Git refs: e.g.
refs/heads/master
This option can be used to restrict access to a fixed set of Git refs with specific values. If you e.g. use the Gitflow workflow for your repository, you can restrict access to the branchesrefs/heads/master
andrefs/heads/develop
Patterns for Git refs: e.g.
tags/**
,?.?
,heads/**/master
Use this option if you want to restrict access to Git refs with branches that can evolve over time. E.g. if you use the Gitflow workflow, one example might bereleases/**
or
release-*
which means that nobody is able to push to a release branch (e.g.,refs/heads/releases/1.0
or
refs/heads/release-1.0
) anymore without a valid pull request. The syntax for these patterns is exactly the same as Bitbucket Server is using for its branch permissions page which is similar to the pattern matching known from Apache Ant. The allowed wildcard expressions are:
?
Matches one character (any character except path separators '/')
*
Matches zero or more characters (not including path separators)
**
Matches zero or more path segments (e.g.
**/tags
matchesrefs/heads/tags
)See here for details: https://confluence.atlassian.com/display/STASH030/Branch+permission+patterns
Pull Request Please uses a pre-receive hook internally to abort a push to one of the specified Git refs. In order to inform the user why a push is not allowed, you can specify a message on this configuration page. For a user it is important that the message clearly stands out from the other text in the console. Therefore, Pull Request Please is able to generate a nice ASCII art message. Just enter some text and hit "Create ASCII art":
Hook in action
After its configuration, Pull Request Please will verify pushes to the specified Git refs and abort a push with the configured hook message whenever a user tries to push without a pull request :