Skip to content

Overview

Gitty is a Swift library that wraps libgit2 — the C library that powers Git operations in GitHub Desktop, GitKraken, and hundreds of other tools. It gives Swift developers a clean, modern API to work with Git repositories directly from their apps.

A Swift Package — the equivalent of an npm package or a RubyGem. You add it as a dependency, import it, and use it. It is not an app, a CLI, or a service.

import Gitty
let repo = try Repository.open(at: url)
let status = try repo.status()

The existing Swift Git libraries are either unmaintained, lack async support, or require complex system dependencies. Gitty is built with three goals:

  • SPM-native — no Homebrew, no CMake, no system setup. Add the package URL and you’re done.
  • Async-first — network operations (clone, fetch, push) use Swift Concurrency natively.
  • Type-safe — results and errors are typed Swift values, not raw integers or stringly-typed responses.
AreaOperations
Repositoryopen, initialize, clone (async)
Stage & Commitstage, unstage, commit, log
Statusworking directory status
Diffworking tree, commit-to-commit
Brancheslist, create, delete, rename, checkout
Remoteslist, add, remove, fetch (async), push (async)
Mergemerge with typed result (fast-forward, merged, conflict)
Rebaserebase onto branch, abort
Cherry-pickpick a commit, handle conflicts
Tagslightweight and annotated, list, delete
Stashpush, pop, apply, drop, list
Blameper-line commit and author attribution
Worktreesadd, remove, lock, unlock
Credentialstoken, username/password, SSH agent

Gitty is a thin Swift layer over libgit2. The C library is bundled via RonenMars/libgit2 — a fork with a Package.swift manifest added for SPM compatibility. No system libgit2 installation is needed.

Your app → Gitty (Swift) → RonenMars/libgit2 (C, via SPM)

All libgit2 pointers are managed automatically via GitPointer, a wrapper that calls the appropriate git_X_free on deinit. You never deal with raw C pointers or manual memory management.

Minimum
Swift5.9
iOS16.0
macOS13.0
Xcode15.0