适合检查拉码变化的git hook(git hook suitable for checking changes in pull code)

编程入门 行业动态 更新时间:2024-10-28 02:33:21
适合检查拉码变化的git hook(git hook suitable for checking changes in pull code)

如问题中所述,在将修改后的代码提取到我的生产基地之后或之时,我想通知其他人有关我的生产基地的更改或通过电子邮件在生产基地中进行的更改。

这里提到的git-hooks与我的标准不符。

任何人都可以建议我一个钩子/脚本/宝石可以做我的工作与示例?

非常感谢提前。

编辑:任何人都可以给我一个合并后钩子的样本

As mentioned in the question, after or at the time of pulling modified code to my production base i want to notify others about changes are going to be done to my production base or changes took place in production base through emails.

git-hooks mentioned here doesn't match with my criteria.

Can any one suggest me a hook/script/gem that can do my job with example?

Thanks a lot in advance.

EDIT: Can any one give me a sample of post-merge hook

最满意答案

它是重复的是拉有什么git钩子吗?

要自定义您的请求并参考此网址https://gist.github.com/sindresorhus/7996717 ,您可以在post-merge准备钩子,如下所示

#/usr/bin/env bash # git hook to run a command after `git pull` if a specified file was changed # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | mailx -s "changes found on production server!" your.mail.box@mail.com } # In this example it's used to send mail if there are any files changed. check_run

it is duplicate of Is there any git hook for pull?

For customising your request and refer this url https://gist.github.com/sindresorhus/7996717, you can prepare the hook post-merge as below

#/usr/bin/env bash # git hook to run a command after `git pull` if a specified file was changed # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" check_run() { echo "$changed_files" | mailx -s "changes found on production server!" your.mail.box@mail.com } # In this example it's used to send mail if there are any files changed. check_run

更多推荐

本文发布于:2023-08-07 20:39:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465914.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:适合   hook   git   suitable   pull

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!