mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
22 lines
630 B
Markdown
22 lines
630 B
Markdown
# codex-git-tooling
|
|
|
|
Helpers for interacting with git, primarily used by Code to capture and restore
|
|
workspace snapshots.
|
|
|
|
```rust,no_run
|
|
use std::path::Path;
|
|
|
|
use code_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()])`.
|