Skip to main content

Module git

Module git 

Source
Expand description

Centralized Git and GitHub CLI operations.

This module provides a clean API for git and GitHub CLI operations, centralizing the scattered std::process::Command calls from across the codebase.

§Overview

The module provides two main types:

  • GitRepo - Wrapper for git repository operations (branch, worktree, commit)
  • GitHub - Wrapper for GitHub CLI operations (PR status)

§Example

use gba_core::git::{GitRepo, GitHub, PrStatus};

let repo = GitRepo::new("/path/to/repo");

// Get current branch
let branch = repo.current_branch().unwrap();

// Stage and commit
repo.add(".").unwrap();
repo.commit("feat: add new feature").unwrap();
repo.push().unwrap();

// Check PR status
let gh = GitHub::new("/path/to/repo");
if let Some(status) = gh.pr_status(&branch).unwrap() {
    match status {
        PrStatus::Open => println!("PR is open"),
        PrStatus::Merged => println!("PR was merged"),
        PrStatus::Closed => println!("PR was closed"),
    }
}

Structs§

GitHub
GitHub CLI operations wrapper.
GitRepo
Git repository operations wrapper.

Enums§

PrStatus
PR status from GitHub CLI.