git_conflict
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:
[]
= "0.1.2"
Initialize a Repo and resolve conflicts:
use ;
let mut repo = init;
if repo.does_conflict_exists
Traits
Initialize — construct a Repo from the current working directory.
GitOps — conflict resolution operations:
does_conflict_exists— check if the index has conflictscheckout_local/checkout_foreign— select which side to keepresolve_conflict_by_discarding— keep one side, discard the otherresolve_conflict_by_combining— strip markers and keep both sidesstaging/commit— stage and commit resolved files
License
MIT — see LICENSE