worktree-tool
Version:
A command-line tool for managing Git worktrees with integrated tmux/shell session management
127 lines • 3.53 kB
TypeScript
import { WorktreeInfo } from "./types.js";
/**
* Git operations wrapper for wtt
*/
export declare class Git {
private git;
constructor(baseDir?: string);
/**
* Check if the current directory is a git repository
*/
isGitRepository(): Promise<boolean>;
/**
* Get the main branch name by checking common names
* Works even in a newly initialized repo with no commits
*/
getMainBranch(): Promise<string>;
/**
* Check if the repository has any commits
*/
hasCommits(): Promise<boolean>;
/**
* Create a new worktree
*/
createWorktree(path: string, branch: string): Promise<void>;
/**
* List all worktrees
*/
listWorktrees(): Promise<WorktreeInfo[]>;
/**
* Get the root directory of the git repository
*/
getRepoRoot(): Promise<string>;
/**
* Check if a branch exists
*/
branchExists(branchName: string): Promise<boolean>;
/**
* Get the status of files in a worktree using porcelain format
*/
getWorktreeStatus(worktreePath: string): Promise<string[]>;
/**
* Get the number of commits ahead and behind the upstream branch
*/
getAheadBehind(worktreePath: string): Promise<{
ahead: number;
behind: number;
}>;
/**
* Get the number of commits ahead and behind compared to another branch
*/
getAheadBehindBranch(worktreePath: string, targetBranch: string): Promise<{
ahead: number;
behind: number;
}>;
/**
* Check if there would be conflicts merging with target branch
*/
hasConflicts(worktreePath: string, targetBranch: string): Promise<boolean>;
/**
* Get worktree information by name
*/
getWorktreeByName(name: string): Promise<WorktreeInfo | null>;
/**
* Get the main worktree
*/
getMainWorktree(): Promise<WorktreeInfo>;
/**
* Check if a worktree has untracked files
*/
hasUntrackedFiles(worktreePath: string): Promise<boolean>;
/**
* Check if a worktree has uncommitted changes
*/
hasUncommittedChanges(worktreePath?: string): Promise<boolean>;
/**
* Check if a worktree has staged changes
*/
hasStagedChanges(worktreePath: string): Promise<boolean>;
/**
* Check if a branch has unmerged commits relative to main
*/
hasUnmergedCommits(branch: string, mainBranch: string): Promise<boolean>;
/**
* Check if a branch has stashed changes
*/
hasStashedChanges(branch: string): Promise<boolean>;
/**
* Check if a worktree has submodule modifications
*/
hasSubmoduleModifications(worktreePath: string): Promise<boolean>;
/**
* Remove a worktree
*/
removeWorktree(worktreePath: string, force?: boolean): Promise<void>;
/**
* Get current branch name
*/
getCurrentBranch(): Promise<string>;
/**
* Fetch latest changes from remote
*/
fetch(): Promise<void>;
/**
* Check if a merge resulted in conflicts
*/
hasMergeConflicts(): Promise<boolean>;
/**
* Get list of conflicted files
*/
getConflictedFiles(): Promise<string[]>;
/**
* Perform a merge
*/
merge(branch: string, message?: string): Promise<{
success: boolean;
conflicts: boolean;
}>;
/**
* Execute a raw git command
*/
raw(args: string[]): Promise<string>;
}
/**
* Create a Git instance for the current directory
*/
export declare function createGit(baseDir?: string): Git;
//# sourceMappingURL=git.d.ts.map