| Crates.io | codex-utils-git |
| lib.rs | codex-utils-git |
| version | 0.63.0 |
| created_at | 2025-12-11 14:01:32.997987+00 |
| updated_at | 2025-12-11 14:01:32.997987+00 |
| description | Git utilities for Codex AI agent |
| homepage | |
| repository | https://github.com/namastexlabs/codex |
| max_upload_size | |
| id | 1979713 |
| size | 96,044 |
Helpers for interacting with git, including patch application and worktree snapshot utilities.
use std::path::Path;
use codex_git::{
apply_git_patch, create_ghost_commit, restore_ghost_commit, ApplyGitRequest,
CreateGhostCommitOptions,
};
let repo = Path::new("/path/to/repo");
// Apply a patch (omitted here) to the repository.
let request = ApplyGitRequest {
cwd: repo.to_path_buf(),
diff: String::from("...diff contents..."),
revert: false,
preflight: false,
};
let result = apply_git_patch(&request)?;
// Capture the current working tree as an unreferenced commit.
let ghost = create_ghost_commit(&CreateGhostCommitOptions::new(repo))?;
// Later, undo back to that state.
restore_ghost_commit(repo, &ghost)?;
Pass a custom message with .message("…") or force-include ignored files with
.force_include(["ignored.log".into()]).