如何在文件库中相对于存储库的路径中为存储库指定git commit消息模板? [英] How to specify a git commit message template for a repository in a file at a relative path to the repository?

查看:77
本文介绍了如何在文件库中相对于存储库的路径中为存储库指定git commit消息模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法指定一个与仓库相关的git commit.template?



对于配置,一个例子是

  $ git config commit.template $ HOME / .gitmessage.txt 

但我想指定一个相对于存储库的.git文件夹的模板文件。

解决方案

这个博客告诉我,如果模板文件的路径不是绝对路径,那么路径被认为是相对于版本库根目录。

$ g $ git config commit.template /绝对/路径/到/文件



git config commit.template相对路径从存储库根目录


Is there a way to specify a git commit.template that is relative to a repository?

For configuration an example is

$ git config commit.template $HOME/.gitmessage.txt

But I would like to specify a template file relative to the .git folder of the repository.

解决方案

This blog tipped me off that if the path to the template file is not absolute, then the path is considered to be relative to the repository root.

git config commit.template /absolute/path/to/file

or

git config commit.template relative-path-from-repository-root

这篇关于如何在文件库中相对于存储库的路径中为存储库指定git commit消息模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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