Files
codex/codex-rs/git-tooling
jimmyfraiture 8c51d50dbb Merge remote-tracking branch 'origin/main' into jif/async-undo-2
# Conflicts:
#	codex-rs/Cargo.lock
#	codex-rs/core/Cargo.toml
#	codex-rs/core/src/state/session.rs
#	codex-rs/core/tests/suite/mod.rs
#	codex-rs/tui/src/chatwidget.rs
#	codex-rs/tui/src/history_cell.rs
2025-10-10 16:52:54 +02:00
..
2025-10-05 21:12:31 +00:00
2025-09-23 16:59:52 +01:00

codex-git-tooling

Helpers for interacting with git.

use std::path::Path;

use codex_git_tooling::{create_ghost_commit, restore_ghost_commit, CreateGhostCommitOptions};

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

// 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()]).