Soenneker.Git.LibGit2Sharp 4.0.326

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Git.LibGit2Sharp --version 4.0.326
                    
NuGet\Install-Package Soenneker.Git.LibGit2Sharp -Version 4.0.326
                    
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="Soenneker.Git.LibGit2Sharp" Version="4.0.326" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Git.LibGit2Sharp" Version="4.0.326" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Git.LibGit2Sharp" />
                    
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 Soenneker.Git.LibGit2Sharp --version 4.0.326
                    
#r "nuget: Soenneker.Git.LibGit2Sharp, 4.0.326"
                    
#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 Soenneker.Git.LibGit2Sharp@4.0.326
                    
#: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=Soenneker.Git.LibGit2Sharp&version=4.0.326
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Git.LibGit2Sharp&version=4.0.326
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Git.LibGit2Sharp

A utility interface for managing Git repositories using LibGit2Sharp and custom operations.

Install

dotnet add package Soenneker.Git.LibGit2Sharp

Quick start

using Soenneker.Git.LibGit2Sharp.Registrars;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
var result = services.AddLibGit2SharpUtilAsSingleton();

Adds ILibGit2SharpUtil as a singleton service.

What you get

  • ILibGit2SharpUtil — A utility interface for managing Git repositories using LibGit2Sharp and custom operations.
  • LibGit2SharpUtilRegistrar — A wrapper around LibGit2Sharp.

API at a glance

API What it does Result / important behavior
ILibGit2SharpUtil.Clone(uri, directory) Clones a Git repository to the specified directory. Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.CloneToTempDirectory(uri, cancellationToken) Clones a Git repository into a temporary directory. The path of the temporary directory the repository was cloned into.
ILibGit2SharpUtil.PullAllGitRepositories(directory, cancellationToken) Pulls the latest changes for all Git repositories recursively found in the specified directory. A task that completes when the pull all git repositories operation is complete.
ILibGit2SharpUtil.FetchAllGitRepositories(directory, cancellationToken) Fetches all remote changes for all Git repositories recursively found in the specified directory. A task that completes when the fetch all git repositories operation is complete.
ILibGit2SharpUtil.SwitchAllGitRepositoriesToRemoteBranch(directory, cancellationToken) Switches all repositories in the specified directory to the tracked remote branch (main). A task that completes when the switch all git repositories to remote branch operation is complete.
ILibGit2SharpUtil.CommitAllRepositories(directory, commitMessage, cancellationToken) Commits all repositories with the given message. A task that completes when the commit all repositories operation is complete.
ILibGit2SharpUtil.PushAllRepositories(directory, token, cancellationToken) Pushes all repositories in the directory using the given credentials. A task that completes when the push all repositories operation is complete.
ILibGit2SharpUtil.SwitchToRemoteBranch(directory) Switches the specified repository to the main remote branch (origin/main). Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.IsRepositoryDirty(directory) Determines whether the given directory contains a Git repository with uncommitted changes. true if the given directory contains a Git repository with uncommitted changes; otherwise, false.
ILibGit2SharpUtil.IsRepository(directory) Determines whether the specified directory is a valid Git repository. true if the specified directory is a valid Git repository; otherwise, false.
ILibGit2SharpUtil.RunCommand(command, directory, cancellationToken) Executes a raw Git command in the given directory. A task that completes when the run command operation is complete.
ILibGit2SharpUtil.Pull(directory, name, email) Pulls changes from the remote repository into the specified local repository. Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.Commit(directory, message, name, email) Commits changes in the given repository using the specified message and author info. Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.Push(directory, token, cancellationToken) Pushes commits from the given repository to its remote using provided credentials. A task that completes when the push operation is complete.
ILibGit2SharpUtil.AddIfNotExists(directory, relativeFilePath) Stages a file if it is not already present in the index. Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.Fetch(directory) Fetches changes from the remote repository without merging them. Returns no value; the requested change is complete when the method returns.
ILibGit2SharpUtil.GetAllGitRepositoriesRecursively(directory, cancellationToken) Recursively retrieves all directories containing valid Git repositories within the given path. The matching records as a materialized collection.
ILibGit2SharpUtil.GetAllDirtyRepositories(directory, cancellationToken) Retrieves all dirty repositories (with uncommitted changes) under the specified path. The matching records as a materialized collection.

Practical notes

  • Cancellation stops pending work; it does not undo work that has already completed.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
4.0.344 0 9/4/2026
4.0.343 0 9/4/2026
4.0.342 0 9/4/2026
4.0.341 0 9/4/2026
4.0.340 0 9/4/2026
4.0.339 0 9/4/2026
4.0.338 27 9/4/2026
4.0.336 39 9/4/2026
4.0.335 31 9/4/2026
4.0.334 28 9/4/2026
4.0.333 54 9/3/2026
4.0.332 69 9/1/2026
4.0.331 81 8/31/2026
4.0.330 74 8/31/2026
4.0.329 80 8/31/2026
4.0.328 88 8/30/2026
4.0.327 81 8/30/2026
4.0.326 87 8/29/2026
4.0.325 81 8/29/2026
4.0.324 81 8/29/2026
Loading failed

Improve README usability and API guidance