问题
I have generated Start Commit Hook in TortoiseGit which calls StartComit.bat file and option "Wait for the script to finish" is enabled.
The content of the bat file is
echo "Some more info...." >> %1
The script is getting called before Commit dialog opens but it's not working, I'm not getting any text in Message field.
What am I doing wrong here?
Edit: Just to make question more clear I'm trying to fallow this accepted answer https://stackoverflow.com/a/3967136/596935 and do a similar thing.
回答1:
%1 is the path to a file containing all selected files when starting the commit dialog and not the path to the file for the message which is %2.
See https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html#tgit-dug-settings-hooks for a manual regarding the parameters.
Thus,
echo Some more info.... >> %2
should solve this issue.
来源:https://stackoverflow.com/questions/38371758/tortoisegit-git-commit-message-from-script