Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ANSIENG-2966] Update readme with git hook details #1533

Open
wants to merge 1 commit into
base: 6.0.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,23 @@ Git Commit Messages
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
* Commit message format should be [ANSIENG-\<jira-id\>] | \<commit-msg\>

To automatically get jira id in commit message do the following -

1. Create a file prepare-commit-message with contents -
```bash
#!/bin/bash

BRANCH_NAME=`git symbolic-ref --short HEAD`

if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ]; then
PREFIX=`echo $BRANCH_NAME | sed -e 's:.*-\([^-]*-\(.*\)\)$:\1:'`
sed -i.bak -e "1s/^/[$PREFIX] \| /" $1
fi

```
2. Location of the file on OS X should be `/usr/local/gitconfig/hooks`
3. Make it executable by running `chmod +x /usr/local/gitconfig/hooks/prepare-commit-message`
4. Create a new branch with custom description and the Jira Ticket number appended to it. eg - `fixing-zk-slowness-ANSIENG-1234`
5. Now on making any commit it will automatically prepend the jira ticket id to commit message