( worktreePath: string, filePath: string, )
| 68 | * to indicate path mode (not branch mode). |
| 69 | */ |
| 70 | export async function gitCheckoutFile( |
| 71 | worktreePath: string, |
| 72 | filePath: string, |
| 73 | ): Promise<void> { |
| 74 | assertRegisteredWorktree(worktreePath); |
| 75 | assertValidGitPath(filePath); |
| 76 | |
| 77 | const git = createGit(worktreePath); |
| 78 | // `--` is correct here - we want path semantics |
| 79 | await withLockRetry(worktreePath, () => git.checkout(["--", filePath])); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * Checkout (restore) multiple file paths, discarding local changes. |
no test coverage detected