![]() You may add a named regex capturing group called name to further customize the name extraction. ![]() For example, refs/tags/build-.\* will match a tag refs/tags/build-123 and its name will be shortened to build-123. For a matching ref, its name will be shortened to the last path-segment \('\\/'\). (dlgSgPreferences|dlgSgRepositorySettings).ttpGroupPatterns"Patterns will be matched against the full ref-name, including the refs-prefix. Now, once again they will be assigned to matching groups, possibly replacing other refs or possibly becoming replaced by more recent refs. Next, the refs remaining in the group will be passed on from child to parent commit. Now, once again they will be assigned to matching groups, possibly replacing other refs or possibly becoming replaced by more recent refs."=\ (dlgSgPreferences|dlgSgRepositorySettings).ttpGroupPatterns"Next, the refs remaining in the group will be passed on from child to parent commit. Optionally, enter regular expressions defining additional refs to preserve. (dlgSgPreferences|dlgSgRepositorySettings).lbl"Optionally, enter regular expressions defining additional refs to preserve."=\ Example: `refs\\/tags\\/build\(?.\\\*\)`"=\Ä®nter regular expressions defining the grouping. Pygit2.Repository(".").(dlgSgPreferences|dlgSgRepositorySettings).lbl"Enter regular expressions defining the grouping. In the post-checkout script itâs possible to extract the the git commit message template file path from the git configuration.Git config -global core.hooksPath /path/to/my/centralized/hooksĪnd installing the commit template globally: git config -global commit.template. Itâs possible to use the same configuration across all repositories, by using a global git hooks path (as seen here):.Using the filename from the example above, we get: git config commit.template. With open(GIT_COMMIT_TEMPLATE, "w") as file: GIT_COMMIT_TEMPLATE = ".git/.commit-template"Ä«ranch_name = pygit2.Repository('.').head.shorthand For example, if your feature branches names are ISSUE-123/feature/new-awesome-feature, and you want the commit message to be prefixed with the issue key ISSUE-123, then the following script could be used (I prefer Python): #!/usr/bin/env python3 If, like me, your goal is to preload a commit message based on the branch name, you can use a workaround in which a static commit message template is generated dynamically every time the post-checkout git hook is triggered.įirst, install a git post-checkout hook that writes a commit message template based on the branch name. However, since SmartGit 18.2, commit message templates are supported ( SmartGit What's new). Unfortunately, SmartGit does not support pre-commit git hook. Where tmplfile is the file which contains your commit message template including the path there from your git project's root. To set this in Smartgit, go to "Tools">"Open git shell", then type To use a template you must set the commit.template option in git-config. 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. Git hooks are more versatile than templates. git/hooks directory should give you a good start on writing your own. ![]() ( see My post and the two older posts to which it refers )Ĭommit-msg will also allow you to modify the commit message, but does so after the user has sent the messages. Unfortunately Smartgit does not support this hook. 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. There are 2 hooks which may be of interest to you:
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |