Smartgit: Auto insert commit message

妖精的绣舞 提交于 2019-12-03 13:16:23

There are 2 hooks which may be of interest to you: prepare-commit-msg and commit-msg

prepare-commit-msg is probably the better suited to your purposes as it allows you to pre-fill the commit message before the user sees it. Unfortunately Smartgit does not support this hook. ( see My post and the two older posts to which it refers )

commit-msg will also allow you to modify the commit message, but does so after the user has sent the messages. The example hook scripts in your .git/hooks directory should give you a good start on writing your own.

Git hooks are more versatile than templates. Templates are simpler to use. If your preloaded commit message doesn't have anything dynamic or which would require a shell script to work out, a template may be the more appropriate route. To use a template you must set the commit.template option in git-config. To set this in Smartgit, go to "Tools">"Open git shell", then type

git config commit.template tmplfile

where tmplfile is the file which contains your commit message template including the path there from your git project's root.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!