Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I exploit the same trick to have a script automatically set what it thinks a commit message should be, but still pass it for human review/edit before actually committing and pushing. Come to think of it, you could easily use this to set a default message base and do things like always prefix the directory; I like my commits to be something like "modules/foo: added bar", so I could just alias gc='git commit -m "${PWD##*/}" -e' (well, something like that, but more sophisticated).


For this usecase git has the 'prepare-commit-msg' hook that allows you to configure this per repo.


I use this to insert the jira issue key into the commit message.


Smart. The dev tool I use automatically links my commits to the Jira issue that initiated the project/fix/update. The key and sha are forever linked. It does the same with Clubhouse.


How does the script determine what the commit message should be?


I always have the issue number and short description in the branch name, e.g. foo#123-handle-new-orders.

So that might sometimes be good enough for a first automatic commit message. I typically clean the history before I submit I submit my work to review.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: