git_conflict 0.1.2

A git conflict manager library
Documentation
  • Coverage
  • 0%
    0 out of 20 items documented0 out of 18 items with examples
  • Size
  • Source code size: 26.35 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 481.09 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 30s Average build duration of successful builds.
  • all releases: 29s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 1nuc

git_conflict

Crates.io docs.rs License

Core library for git conflict detection and resolution. Provides traits and implementations for staging, committing, checking out, and resolving conflicts between branches using the git2 crate.


Features

  • Detect whether conflicts exist in the current index
  • Check out local or foreign branch versions of conflicted files
  • Strip conflict markers and combine changes from both branches
  • Stage and commit resolved files programmatically

Usage

Add to your Cargo.toml:

[dependencies]
git_conflict = "0.1.2"

Initialize a Repo and resolve conflicts:


use git_conflict::{git_operations::Repo, GitOps, Initialize};

let mut repo = Repo::init("main".to_string(), "feature".to_string());

if repo.does_conflict_exists() {
    repo.checkout_local().resolve_conflict_by_discarding();
}

Traits

Initialize — construct a Repo from the current working directory.

GitOps — conflict resolution operations:

  • does_conflict_exists — check if the index has conflicts
  • checkout_local / checkout_foreign — select which side to keep
  • resolve_conflict_by_discarding — keep one side, discard the other
  • resolve_conflict_by_combining — strip markers and keep both sides
  • staging / commit — stage and commit resolved files

License

MIT — see LICENSE