Skip to content

CreativeCodersTeam/GitTools

Repository files navigation

GitTools

A .NET CLI tool and Git abstraction library for streamlined Git workflows with GitHub and GitLab integration.

Build .NET NuGet License

Features | Getting started | Usage | Configuration | Architecture | Building from source

Overview

GitTools provides the gt CLI tool and a set of .NET libraries that simplify everyday Git workflows. It wraps LibGit2Sharp in a clean abstraction layer and adds high-level commands for managing feature branches, releases, tags, and more — with first-class support for both GitHub and GitLab.

Features

  • Feature workflow — start and finish feature branches following a GitFlow-style process
  • Branch management — list, inspect, pull, push, and update all permanent branches at once
  • Release management — create versioned releases via Git tags with optional auto-increment
  • Tag management — create, delete, fetch, and list tags locally and remotely
  • GitHub integration — automatic pull request creation via Octokit
  • GitLab integration — automatic merge request creation via GitLabApiClient
  • Credential support — seamless authentication through Git Credential Manager
  • Git abstraction layer — clean interfaces (IGitRepository, IGitRepositoryFactory, ...) for testable Git operations
  • Per-repository configuration — JSON-based configuration with sensible defaults

Getting started

  1. Install the tool:
    dotnet tool install --global CreativeCoders.GitTool
  2. Navigate to any Git repository:
    cd your-repo
  3. Start your first feature:
    gt feature start my-feature

Important

Requires .NET 10 SDK or later and Git installed on your machine. Git Credential Manager is recommended for authentication.

Usage

Run gt --help to see all available commands.

Feature branches

# Start a new feature branch (branches off develop or main)
gt feature start <feature-name>

# Finish the feature: merge, push, and open a pull/merge request
gt feature finish [<feature-name>]

Branch commands

gt branch list                # List all local and remote branches
gt branch info                # Show details about the current branch
gt branch pull                # Pull the current branch from remote
gt branch push                # Push the current branch to remote
gt branch update              # Pull all permanent local branches (main, develop, ...)

Release commands

gt release create 1.2.0              # Create a release tag v1.2.0
gt release create --increment minor  # Auto-increment the minor version
gt release list-versions             # List all version tags

Tag commands

gt tag create <name>          # Create a new tag
gt tag delete <name>          # Delete a tag locally (and optionally on remote)
gt tag fetch                  # Fetch all tags from remote
gt tag list                   # List all tags

Other commands

gt showconfig                 # Show the effective configuration for the current repository

Configuration

The tool reads its configuration from a JSON file located at:

Platform Path
Windows %LOCALAPPDATA%\CreativeCoders\GitTool\gt.json
macOS ~/Library/Application Support/CreativeCoders/GitTool/gt.json
Linux ~/.local/share/CreativeCoders/GitTool/gt.json
Example configuration
{
  "tool": {
    "defaultGitServiceProviderName": "github"
  },
  "GitServiceProviders": {
    "GitHub": {
      "Hosts": ["github.com"]
    },
    "GitLab": {
      "Hosts": ["gitlab.com"]
    }
  }
}

Per-repository configuration files (prefix repo_) in the same folder allow repository-specific overrides such as a custom develop branch name, feature branch prefix, or disabling TLS certificate validation for self-hosted instances.

Repository configuration defaults
Setting Default
featureBranchPrefix feature/
developBranch develop
hasDevelopBranch true
gitServiceProviderName github
disableCertificateValidation false

Git abstraction library

Beyond the CLI, GitTools ships a set of libraries that provide a clean, testable abstraction over LibGit2Sharp. You can reference these projects directly if you want to build your own Git tooling on top of them.

Register the services via dependency injection:

services.AddGit();

Then inject IGitRepositoryFactory to open repositories:

public class MyService(IGitRepositoryFactory repoFactory)
{
    public void DoWork()
    {
        using var repo = repoFactory.OpenRepository("/path/to/repo");
        var branches = repo.Branches;
        // ...
    }
}

The abstraction layer exposes interfaces like IGitRepository, IGitRepositoryFactory, and IGitRepositoryUtils — making it straightforward to mock Git operations in tests.

Architecture

Project structure
source/
├── Git/
│   ├── CreativeCoders.Git.Abstractions                # Interfaces & models for Git operations
│   ├── CreativeCoders.Git                             # LibGit2Sharp-based implementation
│   └── CreativeCoders.Git.Auth.CredentialManagerCore  # GCM credential provider
└── GitTool/
    ├── CreativeCoders.GitTool.Base              # Shared base types, configuration, return codes
    ├── CreativeCoders.GitTool.Cli.Commands      # All CLI command implementations
    ├── CreativeCoders.GitTool.Cli.GtApp         # Entry point / host setup (the `gt` executable)
    ├── CreativeCoders.GitTool.GitHub            # GitHub service provider (Octokit)
    └── CreativeCoders.GitTool.GitLab            # GitLab service provider (GitLabApiClient)

Building from source

# Restore and build
dotnet build GitTools.sln

# Run all tests
dotnet test GitTools.sln

# Pack the tool locally
dotnet pack source/GitTool/CreativeCoders.GitTool.Cli.GtApp/CreativeCoders.GitTool.Cli.GtApp.csproj

Tip

Found a bug or have a question? Open an issue.

About

Tools for working with Git

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages