在python / bash脚本中编写Git钩子 [英] Writing Git hooks in python/bash scripts

查看:260
本文介绍了在python / bash脚本中编写Git钩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近需要编写git hooks,所有提交引用特定的票据。

I have recently needed to write git hooks, for all commits to reference a particular ticket.

我希望有一个地方可以开始学习。 pro git书中的所有内容都是用Ruby编写的。由于Ruby不是我的强项,任何人都可以分享有关用其他语言编写的git钩子的教程吗? (我特别喜欢Python或Bash脚本。)

I was hoping for a place to start learning. All the stuff in the pro git book is written in Ruby. Since Ruby is not my strong suit, can anybody share tutorials about git hooks written in other languages? (I'd particularly prefer Python or Bash scripts.)

推荐答案

这里是一个使用Python进行hook的例子。一般来说,钩子是语言不可知的。您可以使用脚本来完成一些工作,或者使用0 /其他返回码退出,以改变git过程的流程。

Here is an example of using Python for a hook. In general the hooks are language agnostic. You use the script to do some work or to exit with a 0/other return code to alter the flow of a git process.

这篇关于在python / bash脚本中编写Git钩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆