简体   繁体   English

如何让 IntelliJ IDEA 尊重 pre-commit-msg 钩子

[英]How to make IntelliJ IDEA respect pre-commit-msg hook

I would like to prefill the commit message depending on the branch name I am currently on.我想根据我当前所在的分支名称预填充提交消息。 I have this working with a pre-commit-msg hook from the command line but when commiting from IDEA there is no effect.我在命令行中使用了pre-commit-msg钩子,但是从 IDEA pre-commit-msg时没有效果。 The commit msg is prepopulated by the last commit msg (I think?).提交 msg 由最后一个提交 msg 预先填充(我认为?)。 Is there a way to get this working?有没有办法让这个工作?

Edit: I just found out that the hook is working when I reword a commit message in IDEA.编辑:当我在 IDEA 中改写提交消息时,我才发现钩子正在工作。 But that's not what I want.但这不是我想要的。

This is not possible, unfortunately.不幸的是,这是不可能的。 Commit dialog is shown before any git commit operations are called, that is why to hooks is executed.在调用任何 git commit 操作之前会显示提交对话框,这就是执行 to hooks 的原因。

Please follow https://youtrack.jetbrains.com/issue/IDEA-114680请关注https://youtrack.jetbrains.com/issue/IDEA-114680

Maybe a plugin like this may help you to achieve your goal: https://plugins.jetbrains.com/plugin/9278-pre-commit-hook-plugin也许这样的插件可以帮助您实现目标: https : //plugins.jetbrains.com/plugin/9278-pre-commit-hook-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM