Skip to content

Commit

Permalink
Added section to readme about validating bumps in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
JKrag committed Sep 21, 2017
1 parent 5a3cba4 commit 74a3511
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,16 @@ Options:
E.g. --minorpattern='\+minor'
```


### Helping users
If you decide to require bumps on every commit (e.g. instead of assuming +patch as default), then it can be very helpful to users set up a push hook (pre-receive on Git) that rejects commits without a bump.

I have succesfully done this on BitBucket using the "Jira Hooks for BitBucket" plugin (that we were using anyway), and used the following regex:
```
(^|(.|\n)*\s)\+(major|minor|patch)($|\s(.|\n)*)
```

This RegEx should also be quite usable in other plugins or handwritten hooks as it does not require multiline or other swithes to be supported.
It allows the `+bump` message to appear anywhere in the commit message as long as it is not adjacent to other text. (i.e. `my+patch` and `+patching` will be rejected.
### Helping users``
### Helping users

0 comments on commit 74a3511

Please sign in to comment.