如何Git的分支名称添加到提交信息? [英] How to add Git's branch name to the commit message?

查看:118
本文介绍了如何Git的分支名称添加到提交信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个Bash脚本一些帮助作为哈希在提交信息,将自动添加Git的分支名称。

I need some help with a Bash script that will automatically add the git's branch name as a hash in commit messages.

推荐答案

使用 prepare提交-MSG 提交-MSG githook

有例子已经在你的 PROJECT / git的/钩/ 目录。

There are examples already in your PROJECT/.git/hooks/ directory.

作为一种安全措施,你必须手动启用你想使用它,每个库这样的钩子。虽然,你可以提交脚本并复制它所有克隆到的.git /钩/ 目录。

As a security measure, you will have to manually enable such a hook on each repository you wish to use it. Though, you can commit the script and copy it on all clones into the .git/hooks/ directory.

这篇关于如何Git的分支名称添加到提交信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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