Repository navigation
Home
Oliver Drobnik edited this page Oct 30, 2026
·
2 revisions
libgit2 as a Swift package — C library and idiomatic Swift SDK. GitKit compiles the official libgit2 C sources straight from an upstream git submodule — no CMake, no system install — and layers a full Swift API over them, on macOS, iOS, Linux, Windows, and Android.
import GitKit
let repo = try Repository.open(at: URL(fileURLWithPath: "/path/to/repo"))
let branch = try repo.currentBranch() // "main"
let report = try repo.status() // git status
try repo.add(paths: ["README.md"]) // git add
let commit = try repo.commitDetailed(
message: "Update README",
author: Signature(name: "Jane", email: "jane@example.com"),
allowEmpty: false) // git commit
print(commit.shortSHA)
for entry in try repo.log(LogQuery(maxCount: 10)) { // git log
print(entry.shortSHA, entry.subject)
}Generated by MissionControl from README.md and Docs/. Edit those, not this page.