I use Git on the command line. I often develop new features in git branches which are named after the Jira issues (Wikipedia: JIRA) related to them, e.g. branch "new-123" for Jira ticket "NEW-123".
I have a local git prepare-commit-msg hook which will create the commit message by fetching the subject of the Jira ticket from Jira. E.g. "Finished #NEW-123: Cool new feature".
However, I prefer to commit straight from the command line:
git commit -m "Finished #NEW-123: Cool new feature"
.
I would like to create the quoted commit message merely by pressing [TAB].
I know the bash completion mechanism (Bash: An Introduction to Programmable Completion). But how to use it together with existing command completion (git has otherwise excellent completion in bash)? Can I "chain" the completion?
Or do I need to reprogram the git completion functions (perhaps by adding a hook to my custom function)?
commit-msg
hook that would look to see if the ticket number was already inserted, and if not, it would insert it. – Feathersgit config --add core.editor true
. note that in that in that case you may want to define e.g.git config --add alias.tagc 'tag -c core.editor $EDITOR'
or, even better, a shell alias. – Octahedral