i使用(使用Husky Package进行常规提交,以确保提交名称使用Angular前端应用程序遵循适当的格式。我如何在Microsoft Net Core Solution中设置此功能,基于I需要包装。
您可以直接从命令行中使用dotnet工具,并通过nuget软件包添加到项目中。
使用版本化:Nuget软件包,版本化的来源
..或用自己的在隐藏的.git/hooks
中,您可以创建自己的commit-msg,以使用正则表达式执行常规提交消息。
这可能是提交消息文件中的bash脚本:
#!/usr/bin/env bash
if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor)((.+?))?: .{1,}$"; then
echo "Aborting commit. Your commit message is invalid." >&2
exit 1
fi
if ! head -1 "$1" | grep -qE "^.{1,50}$"; then
echo "Aborting commit. Your commit message is too long." >&2
exit 1
fi
您可以在MSBuild项目复制任务上自动化消息的副本。
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<ItemGroup>
<_CustomFiles Include="..automationcommit-msg" />
</ItemGroup>
<Copy SourceFiles="@(_CustomFiles)" DestinationFolder="./../.git/hooks" />
</Target>
学分:https://link.medium.com/uwemkdjz1cb