( branchOrHash: string, forceCleanStatus = false, git = simpleGit(), )
| 87 | } |
| 88 | |
| 89 | export async function safeCheckout( |
| 90 | branchOrHash: string, |
| 91 | forceCleanStatus = false, |
| 92 | git = simpleGit(), |
| 93 | ): Promise<void> { |
| 94 | // git requires a clean history to check out a branch |
| 95 | if (forceCleanStatus) { |
| 96 | await git.raw(['reset', '--hard']); |
| 97 | await git.clean(['f', 'd']); |
| 98 | logger.info(`git status cleaned`); |
| 99 | } |
| 100 | await guardAgainstLocalChanges(git); |
| 101 | await git.checkout(branchOrHash); |
| 102 | } |
no test coverage detected