Cake.GitHooks 1.1.1

dotnet add package Cake.GitHooks --version 1.1.1
                    
NuGet\Install-Package Cake.GitHooks -Version 1.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cake.GitHooks" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cake.GitHooks" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Cake.GitHooks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cake.GitHooks --version 1.1.1
                    
#r "nuget: Cake.GitHooks, 1.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cake.GitHooks@1.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cake.GitHooks&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Cake.GitHooks&version=1.1.1
                    
Install as a Cake Tool

Cake.GitHooks

Overview

Cake.GitHooks is a cake addin that provides functionality to manage your git hooks in your cake scripts. It provides a simple API to check availability of your git hooks and to deploy them in a single step. This extension aims to simplify distributing and updating git hooks across the contributors of your project.

Usage

Git hooks are sourced from a folder in your project. The addin installs the hooks to your local git repository.

DeployGitHooks

Deploys hooks to the local .git/hooks directory. (Also checks if deployed git hooks are on the latest version)

DeployGitHooks();

Configuration

To configure the source and destination path of your hooks, you can build GitHooksSettings for each method.

DeployGitHooks(settings => 
{
    settings.SourcePath = "./custom-hooks/";
    settings.DestinationPath = "./.git/hooks/";
});

The default setting of the git hooks source directory is ./hooks. The git hooks are deployed to the destination directory ./.git/hooks.

Example build script

Task("Setup-GitHooks")
    .Does(() =>
{
    DeployGitHooks();
});

RunTarget("Setup-GitHooks");

Getting started

The package is published to the GitHub Packages NuGet registry. To use the package in your Cake build script project, you must add the GitHub Packages NuGet registry to your Cake build script project's NuGet.config file. For more information, see the following link:

https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry#installing-a-package

Add the Cake.GitHooks NuGet package to your Cake build script project.

#addin nuget:?package=Cake.GitHooks

Import the namespace in your Cake build script.

using Cake.GitHooks;

Use the provided aliases in your Cake build script as needed.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 4,745 9/25/2025
1.0.0 6,865 1/8/2025