https://github.com/ibrahimcetin/SwiftGitX
A modern Swift wrapper for libgit2 that brings Git operations to Swift apps.
https://github.com/ibrahimcetin/SwiftGitX
git ios libgit2 macos swift
Last synced: about 20 hours ago
JSON representation
A modern Swift wrapper for libgit2 that brings Git operations to Swift apps.
- Host: GitHub
- URL: https://github.com/ibrahimcetin/SwiftGitX
- Owner: ibrahimcetin
- License: mit
- Created: 2024-06-30T17:58:39.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-01T10:17:40.000Z (7 months ago)
- Last Synced: 2026-06-06T15:04:45.634Z (22 days ago)
- Topics: git, ios, libgit2, macos, swift
- Language: Swift
- Homepage: https://swiftpackageindex.com/ibrahimcetin/SwiftGitX/~/documentation/SwiftGitX
- Size: 272 KB
- Stars: 154
- Watchers: 3
- Forks: 20
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SwiftGitX
[](https://github.com/ibrahimcetin/SwiftGitX/actions/workflows/swift.yml)
[](https://swiftpackageindex.com/ibrahimcetin/SwiftGitX)
[](https://swiftpackageindex.com/ibrahimcetin/SwiftGitX)
Welcome to SwiftGitX! 🎉
SwiftGitX is a modern Swift wrapper for [libgit2](https://libgit2.org). It's designed to make working with Git in Swift easy and efficient. Plus, it fully supports the [Swift Package Manager](https://github.com/swiftlang/swift-package-manager) and has no external dependencies.
```swift
let url = URL(string: "https://github.com/ibrahimcetin/SwiftGitX.git")!
let repository = try await Repository.clone(from: url, to: URL(string: "/path/to/clone")!)
let latestCommit = try repository.HEAD.target as? Commit
let main = try repository.branch.get(named: "main")
let feature = try repository.branch.create(named: "feature", from: main)
try repository.switch(to: feature)
```
## Why Choose SwiftGitX?
SwiftGitX offers:
- **Swift concurrency support**: Take advantage of async/await for smooth, non-blocking Git operations.
- **Throwing functions**: Handle errors gracefully with Swift's error handling.
- **Full 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.
## Adding SwiftGitX to Your Project
To get started, just add SwiftGitX to your project:
1. File > Add Package Dependencies...
2. Enter https://github.com/ibrahimcetin/SwiftGitX.git
3. Select "Up to Next Major" with "0.1.0"
Or add SwiftGitX to your `Package.swift` file:
```swift
dependencies: [
.package(url: "https://github.com/ibrahimcetin/SwiftGitX.git", from: "0.1.0"),
]
```
## Documentation
The documentation for `releases` and `main` are available here:
* [0.x.x](https://swiftpackageindex.com/ibrahimcetin/SwiftGitX/~/documentation/SwiftGitX)
* [`main`](https://swiftpackageindex.com/ibrahimcetin/SwiftGitX/main/documentation/SwiftGitX)
## Building and Testing
SwiftGitX is easy to build and test. It requires only Swift, no additional system dependencies.
To build SwiftGitX, run:
```bash
swift build
```
To test SwiftGitX, run:
```bash
swift test
```
## Contributing
We welcome contributions! Whether you want to report a bug, request a feature, improve documentation, or add tests, we appreciate your help.
**For developers**, when contributing, please ensure to add appropriate tests and documentation to keep our project robust and well-documented.
---
Thank you for considering SwiftGitX for your project. I'm excited to see what you’ll build! 😊
---
Feel free to let me know if there's anything specific you'd like to adjust further! 🚀