Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to default seed the commit comment (but not for merges) with the branch name?

David_Mills October 14, 2015

Hi, we are finding that developers are often incorrectly typing in the JIRA ticket number in the commit comment. We do all our work on JIRA branches and so if we could get Sourcetree to seed the commit comment with the branch name this would remove this issue.
The result of the current situation is that quite a number of JIRA issues show no commits, builds, deploys, etc. And reports produced deom Bamboo, Stash and JIRA are missing these tickets.

2 answers

0 votes
David_Mills November 30, 2015

We found, installed, configured and use the "Yet Another Commit Checker" add-on which works well for this issue.

We ensure that:

  • the committer matches
  • The JIRA Ticket is valid
  • That the assignee is the user and that the status is "in progress"
0 votes
Intel CHD Jira Admin October 16, 2015
David_Mills November 9, 2015

One solution is to add the file commit-msg to every clone's .git/hooks folder with contents similar to: {quote} #!/bin/sh # # An example hook script to check the commit log message. # Called by "git commit" with one argument, the name of the file # that has the commit message. The hook should exit with non-zero # status after issuing an appropriate message if it wants to stop the # commit. The hook is allowed to edit the commit message file. # # To enable this hook, rename this file to "commit-msg". BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) echo "Committing to branch: $BRANCH_NAME" > $1.new echo "User commit comments:" >> $1.new cat $1 >> $1.new mv $1.new $1 {quote}

David_Mills November 9, 2015

But this is a pain as you need to remember to add each and every time you create a clone.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events