TortoiseGit - 更改默认合并信息 [英] TortoiseGit - change default merge message
问题描述
系统描述:
- Windows 7
- git version 2.10.1.windows.1
- TortoiseGit 2.3.0.0
我想:
合并提交信息在完全 strong>自动方式( no 手动修改
)
总结:
在windows上,使用tortoiseGit, code>准备提交-MSG hook ,只有 start-commit-hook
和不管钩子脚本是什么,我得到一个窗口弹出错误:
%1不是有效的Win32应用程序
另外,我希望仅 更改提交消息,即合并。
步骤:
设置钩子:
将工作树路径设置为与我的项目路径相同,即
和in 执行命令行我选择准备的文件:
.git \hooks\prepare-commit-msg
其内容为 echotest
。
然后我尝试做一个提交并得到这个错误:
我确定这个脚本文件确实是使用的文件,
,因为如果我删除它,我得到这样的信息:
TortoiseGit钩子完全独立于vanilla Git钩子。
您可以使用任何脚本语言或可执行文件作为TortoiseGit钩子脚本。但是,在配置中,您必须输入一个有效的Windows可执行文件作为命令,例如一个 .exe
文件,用于 .js
或 .vbs
您需要指定解释器( wscript
或 cscript
)的脚本以及作为解释器参数的脚本路径(cf 。这里) 。对于执行一个bash脚本,我认为你需要用适当的参数执行bash.exe到脚本 - 我以前没有测试过。
执行的钩子会得到一些从TortoiseGit参数,这些都记录此处一>,例如在提交对话框打开时调用 Start-commit
,并获取三个cli参数:PATH MESSAGEFILE CWD,而PATH是包含提交对话框所有条目的文件的路径,MESSAGEFILE是文件的路径,您可以将内容作为提交消息使用,CWD是工作树路径。
可以在上面找到示例 https://github.com/TortoiseGit/TortoiseGit/tree / master / contrib / hook-scripts /客户端
PS:为了检查这是否为合并提交,您可以检查 .git / MERGE_HEAD
。
System description:
- Windows 7
- git version 2.10.1.windows.1
- TortoiseGit 2.3.0.0
I want:
The merge commit message to be different in a fully automated manner (no manual amend
)
Summary:
On windows, using tortoiseGit, there is no prepare-commit-msg
hook, only start-commit-hook
and no matter what the hook script is, I get a windows popup error:
%1 is not a valid Win32 application
Also, I would prefer to only change the commit messages which are "merges".
Steps:
setup the hook:Set the working tree path to be same as my project's path,
and in "Command Line To Execute" I select the file I prepared:
.git\hooks\prepare-commit-msg
which its content is echo "test"
.
Then I try to do a commit and get this error:
I've made sure that this script file is indeed the file which is used,
because if I delete it, I get this message:
TortoiseGit hooks are fully independent of vanilla Git hooks.
You can use any script language or executable as TortoiseGit hook script. However, in the configuration you have to enter a a valid Windows executable as command, e.g. an .exe
file, for .js
or .vbs
scripts you need to specify the interpreter (wscript
or cscript
) and the path to the script as the interpreter parameter (cf. here). For executing a bash script I think you need to execute bash.exe with the appropriate parameters to a script - I haven't tested this before.
The executed hook gets some parameters from TortoiseGit, those are documented here, e.g. the Start-commit
is called when the commit dialog is opened and gets three cli parameters: PATH MESSAGEFILE CWD, whereas PATH is a path to a file containing all entries of the commit dialog, MESSAGEFILE is the path to a file where you can put the contents to which should be used as commit message and CWD is the working tree path.
Examples can be found on https://github.com/TortoiseGit/TortoiseGit/tree/master/contrib/hook-scripts/client-side
PS: In order to check whether this is a merge commit you can check for the existance of .git/MERGE_HEAD
.
这篇关于TortoiseGit - 更改默认合并信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!