我如何传播我的 git 配置/挂钩?
我最近决定希望所有提交到我的存储库的人都填写一个简单的提交日志。基本上我希望他们填写提交消息的表格。
快速搜索找到了我: 如何更改默认注释git 提交消息?
现在,我可以放入一个钩子,用我的表单大纲生成默认提交消息。
但是,我知道出于安全原因,git 不会让我将钩子推送到连接到我的存储库的其他人。
或者,我可以更改 commit.template 以指定模板,每当我进行提交时,我都会看到一个需要填写的表单。
同样,我似乎无法更改其他人机器上的配置。
有没有什么方法可以让每个人在 git 中获得相同的默认提交消息,而无需他们自己设置?
I recently decided that I wanted all people who commit to my repository to fill in a simple commit log. Basically I want them to fill in a form to the commit message.
A quick search found me:
How can I change the default comments in the git commit message?
Now, I can put in a hook to generate a default commit message with my form outline.
However, I understand that for security reasons, git won't let me push a hook to the others who are connected to my repository.
Alternately, I can change my commit.template to specify a template, and I will be presented with a form to fill out whenever I do a commit.
Again, I can't seem to be able to change the configuration on other peoples machines.
Is there any way to give everyone the same default commit message in git without them setting it up themselves?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你既不能传播你的配置,也不能传播你的钩子。
您可以将钩子传播到远程存储库的最接近方法是将钩子签入存储库,并使用脚本将它们复制到
.git/hooks
或创建符号链接(这样的脚本仍然具有当然要手动运行)为了验证提交是否符合您想要的模板,您可以使用“服务器”端挂钩来阻止推送。如果只是为了帮助人们拥有一个好的默认模板,请提供如上所述的“客户端”挂钩并要求他们“安装”它们。
No you can neither propagate your config nor hooks.
Closest you can come to propagate your hooks to remote repositories is checking in the hooks to the repository and have scripts that will either copy them to
.git/hooks
or create symlinks ( and such a script would still have to be run manually, of course )To verify that the commits adhere to the template that you want, you can have "server" side hooks that will prevent the push. If it is just about helping people to have a good default template, provide the "client" hooks like mentioned above and ask them to "install" them.