Expand description
Git operations for worktree-setup.
This crate provides git operations using the git2 library, including:
- Repository discovery and information
- Worktree listing, creation, and management
- File status detection (unstaged, untracked)
§Example
ⓘ
use worktree_setup_git::{open_repo, get_worktrees, create_worktree};
let repo = open_repo(".")?;
let worktrees = get_worktrees(&repo)?;
println!("Found {} worktrees", worktrees.len());Structs§
- Repository
- An owned git repository, representing all state associated with the underlying filesystem.
- Worktree
Create Options - Options for creating a new worktree.
- Worktree
Info - Information about a git worktree.
Enums§
- GitError
- Errors that can occur during git operations.
Functions§
- create_
worktree - Create a new worktree using git CLI.
- delete_
branch - Delete a local branch using the git CLI.
- discover_
repo - Discover a git repository by searching upward from the given path.
- fetch_
remote - Fetch from a remote using the git CLI.
- get_
current_ branch - Get the current branch name.
- get_
default_ branch - Get the default branch name.
- get_
local_ branches - Get a list of local branch names.
- get_
main_ worktree - Get the main worktree.
- get_
recent_ branches - Get recently checked-out branches from the reflog.
- get_
remote_ branches - Get a list of remote branch names for a specific remote.
- get_
remotes - Get a list of remote names configured for the repository.
- get_
repo_ root - Get the root directory of the main worktree for a repository.
- get_
unstaged_ and_ untracked_ files - Get a list of unstaged and untracked files.
- get_
workdir - Get the working directory of the current worktree.
- get_
worktrees - Get a list of all worktrees for a repository.
- open_
repo - Open a git repository at the specified path.
- prune_
worktrees - Prune stale worktree registrations using the git CLI.
- remove_
worktree - Remove a linked worktree using the git CLI.