# SwiftGitX: Integrate Git to Your Apps

**URL:** <https://forums.swift.org/t/swiftgitx-integrate-git-to-your-apps/77827>\
**Category:** Community Showcase\
**Tags:** swift-package\
**Created:** [February 12, 2025, 7:05pm UTC](https://forums.swift.org/t/swiftgitx-integrate-git-to-your-apps/77827 "2025-02-12T19:05:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibrahimcetin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ibrahimcetin/32/29816_2.png) [@ibrahimcetin](https://forums.swift.org/u/ibrahimcetin)\
**Post date:** [February 12, 2025, 7:05pm UTC](https://forums.swift.org/t/swiftgitx-integrate-git-to-your-apps/77827/1 "2025-02-12T19:05:20Z")

</div>

Hi folks, I would like to share [SwiftGitX](https://github.com/ibrahimcetin/SwiftGitX) with you. It is modern Swift wrapper for libgit2 which is for integrating git to your apps. The API is similar to git command line and it supports modern swift features.

# Getting Started

SwiftGitX provides easy to use api.

```swift
// Do not forget to initialize
SwiftGitX.initialize()

// Open repo if exists or create
let repository = try Repository(at: URL(fileURLWithPath: "/path/to/repository"))

// Add & Commit
try repository.add(path: "README.md")
try repository.commit(message: "Add README.md")

let latestCommit = try repository.HEAD.target as? Commit

// Switching branch
let featureBranch = try repository.branch.get(named: "main")
try repository.switch(to: featureBranch )

// Print all branches
for branch in repository.branch {
    print(branch.name)
}

// Get a tag
let tag = try repository.tag.get(named: "1.0.0")

SwiftGitX.shutdown()

```

# Key Features

- **Swift concurrency support** : Take advantage of async/await for smooth, non-blocking Git operations.
- **Throwing functions** : Handle errors gracefully with Swift's error handling.
- **SPM support** : Easily integrate SwiftGitX into your projects.
- **Intuitive design** : A user-friendly API that's similar to the Git command line interface, making it easy to learn and use.
- **Wrapper, not just bindings** : SwiftGitX provides a complete Swift experience with no low-level C functions or types. It also includes modern Git commands, offering more functionality than other libraries.

# Installing & Source Code

You can find more from [GitHub repository](https://github.com/ibrahimcetin/SwiftGitX). Don't forget to give a star if you find it useful!

# Documentation

You can find documentation from [here](https://ibrahimcetin.github.io/SwiftGitX/documentation/swiftgitx/). Or, you can check out the [tests folder](https://github.com/ibrahimcetin/SwiftGitX/tree/main/Tests/SwiftGitXTests).

# Current Status of The Project

SwiftGitX supports plenty of the core functions but there are lots of missing and planned features to be implemented. I prepared a [draft roadmap](https://github.com/users/ibrahimcetin/projects/1) in case you would like to contribute to the project, any help is appreciated.

Thank you for your attention. I look forward to your feedback.

---

<div class="post-metadata">

**Author:** ![ibrahimcetin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ibrahimcetin/32/29816_2.png) [@ibrahimcetin](https://forums.swift.org/u/ibrahimcetin)\
**Post date:** [December 1, 2025, 11:52am UTC](https://forums.swift.org/t/swiftgitx-integrate-git-to-your-apps/77827/2 "2025-12-01T11:52:07Z")

</div>

SwiftGitX now works on **Linux** , **Android** , **watchOS** , and **tvOS** in addition to **iOS** and **macOS**.

I also added Swift 6 support, auto runtime management, better error handling, and more. I reorganized the codebase for easier development.

My goal is to add all [everyday git](https://git-scm.com/docs/everyday) features and provide a complete Swift experience to developers.
