Oakrey.Applications.Git 3.0.3

dotnet add package Oakrey.Applications.Git --version 3.0.3
                    
NuGet\Install-Package Oakrey.Applications.Git -Version 3.0.3
                    
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="Oakrey.Applications.Git" Version="3.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.Applications.Git" Version="3.0.3" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.Applications.Git" />
                    
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 Oakrey.Applications.Git --version 3.0.3
                    
#r "nuget: Oakrey.Applications.Git, 3.0.3"
                    
#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 Oakrey.Applications.Git@3.0.3
                    
#: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=Oakrey.Applications.Git&version=3.0.3
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.Applications.Git&version=3.0.3
                    
Install as a Cake Tool

Oakrey.Applications.Git

A .NET 10 Windows library for managing one or more Git repositories programmatically. Built on Oakrey.Git (LibGit2Sharp), it exposes async operations for all common Git workflows, tracks per-repository state as INotifyPropertyChanged properties for WPF binding, and surfaces errors as an IObservable<string> stream. Includes a design-time stub (DummyGitRepositoryManager) and integrates with Oakrey logging and telemetry.

Main Features

  • Multi-repository management via GitRepositoryManager and IGitRepositoryManager.
  • Full async Git operations: Clone, Fetch, Pull, Push, Commit, CommitAll, CommitPush, Reset.
  • Branch operations: Checkout, CreateBranch (from HEAD or from a named target branch).
  • Per-repository change tracking: IsChanged, IncomingCommits, OutgoingCommits, FilesChanged.
  • CurrentBranch and LocalBranches discovery.
  • INotifyPropertyChanged on all state properties � ready for direct WPF binding.
  • IObservable<string> ErrorMessage reactive error stream per repository.
  • Credential and author management via GitUser; batch update via UpdateCredentials().
  • Application startup integration via IPreLoadable on GitRepositoryManager.
  • DummyGitRepositoryManager for design-time and test scenarios.
  • Integrated with Oakrey.Telemetry (distributed tracing) and Oakrey.Log (structured logging).

Architecture

classDiagram
    class IGitRepositoryManager {
        +List~GitRepository~ Repositories
        +AddRepository(GitRepositoryDefinition)
    }

    class GitRepositoryManager {
        +GitRepositoryManager(IGitManagerSettings)
        +UpdateCredentials()
        +UpdateRepositoriesBranches()
        +GetGitRepositoryManagerSetting() GitUser
    }

    class DummyGitRepositoryManager

    class GitRepository {
        +string Name
        +string CurrentBranch
        +string CommitMessage
        +bool IsChanged
        +int IncomingCommits
        +int OutgoingCommits
        +List~string~ LocalBranches
        +ObservableCollection~TreeEntryChanges~ FilesChanged
        +IObservable~string~ ErrorMessage
        +Clone(CancellationToken)
        +Fetch(CancellationToken)
        +Pull(CancellationToken)
        +Push(CancellationToken)
        +Commit(CancellationToken)
        +CommitAll(CancellationToken)
        +CommitPush(CancellationToken)
        +Checkout(branchName)
        +CreateBranch(branchName, CancellationToken)
        +Reset()
        +UpdateBranches()
        +SetCredentials(username, password)
        +SetAuthor(author, email)
    }

    class IGitManagerSettings {
        +GitUser User
        +List~GitRepositoryDefinition~ Repositories
    }

    class GitManagerSettings

    IGitRepositoryManager <|.. GitRepositoryManager
    IGitRepositoryManager <|.. DummyGitRepositoryManager
    GitRepositoryManager --> GitRepository
    GitRepositoryManager --> IGitManagerSettings
    IGitManagerSettings <|.. GitManagerSettings
Type Responsibility
IGitRepositoryManager Public contract for repository collection management
GitRepositoryManager Creates and owns GitRepository instances; batch credential and branch updates; startup integration via IPreLoadable
DummyGitRepositoryManager Stub with pre-populated repositories for design-time and tests
GitRepository Per-repository state and all async Git operations; INPC + reactive error stream
IGitManagerSettings / GitManagerSettings Configuration model: GitUser and List<GitRepositoryDefinition>

Requirements

  • .NET 10 (Windows)
  • Oakrey.Git >= 2.0.1
  • Oakrey.Log >= 2.0.0
  • Oakrey.Telemetry >= 2.0.1
  • System.Reactive >= 6.1.0

Installation

.NET CLI

dotnet add package Oakrey.Applications.Git

Package Manager Console

Install-Package Oakrey.Applications.Git

NuGet Package Manager

Search for Oakrey.Applications.Git under Tools > NuGet Package Manager > Manage NuGet Packages for Solution.

Configuration

Provide an IGitManagerSettings implementation (or use the built-in GitManagerSettings) when constructing GitRepositoryManager.

GitManagerSettings settings = new()
{
    User = new GitUser("username", "password", "Display Name", "user@example.com"),
    Repositories =
    [
        new GitRepositoryDefinition("MyRepo", "https://example.com/repo.git", @"C:\Work\MyRepo")
    ]
};

IGitRepositoryManager manager = new GitRepositoryManager(settings);

Adding a repository at runtime:

manager.AddRepository("AnotherRepo", "https://example.com/other.git", @"C:\Work\Other");

Example Usage

Performing Git operations on a repository

GitRepository repo = manager.Repositories[0];

await repo.Clone(CancellationToken.None);
await repo.Fetch(CancellationToken.None);

repo.CommitMessage = "Fix: correct calculation";
await repo.CommitPush(CancellationToken.None);

Subscribing to the error stream

repo.ErrorMessage.Subscribe(error =>
{
    if (!string.IsNullOrEmpty(error))
    {
        Console.WriteLine($"Git error: {error}");
    }
});

WPF binding (MVVM)

GitRepository implements INotifyPropertyChanged, so its properties bind directly:

<TextBlock Text="{Binding CurrentBranch}" />
<TextBlock Text="{Binding IncomingCommits}" />
<CheckBox IsChecked="{Binding IsChanged, Mode=OneWay}" />
<ListView ItemsSource="{Binding FilesChanged}" />

Design-time / test stub

IGitRepositoryManager manager = new DummyGitRepositoryManager();
// Returns two pre-populated GitRepository instances with realistic state.

Development Notes

  • The project targets net10.0-windows; it is not cross-platform due to Oakrey.Git (LibGit2Sharp) dependencies.
  • GitRepositoryManager implements IPreLoadable, which integrates with the Oakrey application startup pipeline.
  • GitRepository.ErrorMessage is a BehaviorSubject<string> � new subscribers immediately receive the last error value.
  • All operations use Activity from Oakrey.Telemetry.Tracing for distributed tracing; ensure a tracer is configured to capture spans.
  • Credential expiry throws LibGit2SharpException � callers should handle this case explicitly, as the error message instructs users to renew credentials.

Project Information

Property Value
Author Oakrey
License MIT
NuGet package Oakrey.Applications.Git
Repository https://dev.azure.com/oakrey/OpenPackages/_git/ApplicationServices
Package URL https://www.nuget.org/packages/Oakrey.Applications.Git

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
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
3.0.3 35 5/15/2026
3.0.2 126 3/13/2026
3.0.1 109 2/11/2026
3.0.0 438 11/18/2025
2.0.2 178 10/10/2025
2.0.1 217 9/29/2025
2.0.0 322 6/9/2025
1.0.0 287 4/17/2025