TortoiseGit - change default merge message

System Description:

  • Windows 7
  • git version 2.10.1.windows.1
  • TortoiseGit 2.3.0.0





I want to:

Merge commit message should be completely different in automatic mode (without amend )





Summary:

In windows using tortoiseGit there is no prepare-commit-msg hook , only start-commit-hook and no matter what the script hook is, I get a windows popup:

 %1 is not a valid Win32 application 

In addition, I would prefer only to change the commit messages that "merge".





Actions:

set the hook:

enter image description here

Set the working tree path to the same as my project path,
and in the "Command line for execution" I select the file that I prepared:

 .git\hooks\prepare-commit-msg 

whose contents are echo "test" .

Then I try to commit and get this error:

enter image description here

I made sure that this script file is really the file that is being used,
because if I delete it, I get this message:

enter image description here

+2
git tortoisegit
Oct 10 '16 at 13:27
source share
1 answer

TortoiseGit hooks are completely independent of Git vanilla hooks.

You can use any script language or executable as a TortoiseGit hook script. However, in the configuration you need to enter a valid Windows executable as a command, for example. a .exe , for .js or .vbs scripts you need to specify the interpreter ( wscript or cscript ) and the path to the script as an interpreter parameter (see here ). To run a bash script, I think you need to run bash.exe with the appropriate script parameters - I have not tested this before.

The executed hook gets some parameters from TortoiseGit, which are documented here , for example. Start-commit is called when the commit dialog opens and receives three cli parameters: PATH MESSAGEFILE CWD, while PATH is the path to the file containing all the entries in the commit dialog, MESSAGEFILE is the path to the file to which you can go to use as a commit message, and CWD is the path of the working tree.

Examples can be found at https://github.com/TortoiseGit/TortoiseGit/tree/master/contrib/hook-scripts/client-side

PS: To check if this is a merge commit, you can check for the presence of .git/MERGE_HEAD .

+2
Oct 10 '16 at 14:11
source share



All Articles