zoukankan      html  css  js  c++  java
  • Git配置commit提交模板template

    Git在提交时如果需要以指定的格式提交,可以给Git配置一个提交模板,配置好后,每次Git commit时都会将模板中的信息作为初始化信息自动填充到编辑器的提交信息中。

    以命令的方式配置: git config --global commit.template ~/.gitmessage.txt

    在Git配置文件中配置: 在Git配置文件的commit下添加一项template即可,Git配置文件通常在 C:UsersAdministrator.gitconfig。其实以命令的方式执行后,它会自动在配置文件中生成这一项,Git commit的时候会去配置文件中读取这一项指定的文件中的内容,并把该内容作为初始化信息填写到提交信息中。

    [commit]
    	template = C:/Users/Administrator/.gitmessage.txt
    

    注意: 这里的模板文件路径是以斜杠的方式作为路径分隔符,即便是在Windows上,也是斜杠。而且文件本身只要是文本文件即可,不一定必须是txt文件,该文件也并没有规定必须放在什么位置,只需要将你实际的模板文件路径填写进去即可。

    示例: 我在D盘根目录下创建一个文本文件commit_template,文本内容为:

    需求/问题单号:
    描述:
    提交人:
    

    执行命令 git config --global commit.template D:/commit_template ,之后查看配置文件 C:UsersAdministrator.gitconfig,多了以下内容:

    [commit]
    	template = D:/commit_template
    

    修改Git仓库内容并提交,编辑器中显示如下内容:

  • 相关阅读:
    iOS中按钮点击事件处理方式
    用PNChart绘制折线图
    用PNChart绘制饼状图简介
    MWeb发布到博客园配置
    对数组排序后,获取排序前元素索引
    iOS学习笔记之触摸事件&UIResponder
    iOS学习笔记之UITableViewController&UITableView
    4.matplotlib绘制直方图
    2. matplotlib绘制散点图
    3.matplotlib绘制条形图
  • 原文地址:https://www.cnblogs.com/guyuyun/p/15028409.html
Copyright © 2011-2022 走看看