Skip to content

A modern Swift wrapper for libgit2 to interact with Git repositories.

License

Notifications You must be signed in to change notification settings

ibrahimcetin/SwiftGitX

Repository files navigation

SwiftGitX

Welcome to SwiftGitX! 🎉

SwiftGitX is a modern Swift wrapper for libgit2. It's designed to make working with Git in Swift easy and efficient. Plus, it fully supports the Swift Package Manager and has no external dependencies.

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:

dependencies: [
    .package(url: "https://github.com/ibrahimcetin/SwiftGitX.git", from: "0.1.0"),
]

Documentation

You can access the documentation in three ways:

  • Online Documentation – Based on the most recent tagged release: View here.
  • Xcode Documetation - Thanks to Swift-Docc, you can access everything seamlessly in Xcode.
  • Upstream Documentation – Reflecting the latest changes from the main branch: View here.

Building and Testing

SwiftGitX is easy to build and test. It requires only Swift, no additional system dependencies. To build SwiftGitX, run:

swift build

To test SwiftGitX, run:

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! 🚀

About

A modern Swift wrapper for libgit2 to interact with Git repositories.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages