Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
6e93e4c4
Commit
6e93e4c4
authored
Mar 03, 2016
by
Sytse Sijbrandij
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tell customers to request hooks.
parent
df4f05bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
doc/git_hooks/git_hooks.md
doc/git_hooks/git_hooks.md
+13
-10
No files found.
doc/git_hooks/git_hooks.md
View file @
6e93e4c4
# Git Hooks
Sometimes you need additional control over pushes to your repository.
GitLab already offers protected branches.
But there are cases when you need some specific rules like preventing git tag removal or enforcing a special format for commit messages.
Sometimes you need additional control over pushes to your repository.
GitLab already offers protected branches.
But there are cases when you need some specific rules like preventing git tag removal or enforcing a special format for commit messages.
GitLab Enterprise Edition offers a user-friendly interface for such cases.
Git hooks are defined per project so you can have different rules applied to different projects depends on your needs.
Git hooks settings can be found at Project settings -> Git Hooks page.
Git hooks are defined per project so you can have different rules applied to different projects depends on your needs.
Git hooks settings can be found at Project settings -> Git Hooks page.
## New hooks
If you are a subscriber and need a hook that is not there yet we would be glad to add it for free, please contact support to request one.
## How to use
...
...
@@ -16,12 +19,12 @@ Let's assume you have the following requirements for your workflow:
*
every commit should reference a reference JIRA issue. For example:
`Refactored css. Fixes JIRA-123. `
*
users should not be able to remove git tags with
`git push`
All you need to do is write simple regular expression that requires mention of JIRA issue in a commit message.
It can be something like this
`/JIRA\-\d+/`
.
Just paste regular expression into commit message textfield(without start and ending slash) and save changes.
See the screenshot below:
All you need to do is write simple regular expression that requires mention of JIRA issue in a commit message.
It can be something like this
`/JIRA\-\d+/`
.
Just paste regular expression into commit message textfield(without start and ending slash) and save changes.
See the screenshot below:
![
screenshot
](
git_hooks.png
)
Now when a user tries to push a commit like
`Bugfix`
- their push will be declined.
Now when a user tries to push a commit like
`Bugfix`
- their push will be declined.
And pushing commit with message like
`Bugfix according to JIRA-123`
will be accepted.
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment