Q:

git subtree custom message for squashed commit

I am trying to add a subtree to my git project.  Using git subtree add --prefix <prefix> <repo.git> trunk --squash --message "JIRA: xyz" I could modify the commit message for the merge-commit that subtree add generates. 
*   4795f8f (HEAD, currbranch) JIRA xyz 
|\
| * 66d3640 Squashed 'prefix path' content from commit blah
* 9bd5f02 (origin/master) JIRA def:

However, I also need to edit the commit message for the squashed commit 66d3640 that git subtree add generates.  I can't figure out any way to edit that commit's msg to add "JIRA: abc" (and without JIRA in commit message, bitbucket throws error). 
Any help would be awesome!  Thanks! 

A:

After doing "git subtree add" you can use git filter-branch to rewrite message of squashed commit as follows:
git filter-branch -f --msg-filter 'sed "s/Squashed/JIRA: xyz Squashed/g"' HEAD...HEAD~1

This will add JIRA: xyz at the beggining of commit message. 
It's also possible to fully replace first line of commit message:
git filter-branch -f --msg-filter 'sed "s/Squashed.*/{new commit message}/g"' HEAD...HEAD~1

Please keep in mind that you would need to escape some characters in your new commit message.  For example:

/ escaped with \/
' escaped with '\''

