Skip to content

Commit

Permalink
Make sure to checout main branch when using cache (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaja-nav authored Feb 12, 2024
1 parent a9ff540 commit 9f0a32e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/common/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ export class Gitter {
const repoClient = this.createRepoGitClient(repo)

if (this.type === 'cache') {
repoClient.clean([CleanOptions.FORCE, CleanOptions.RECURSIVE]).reset(ResetMode.HARD, ['origin/HEAD']).pull({
'--rebase': null,
})
repoClient
.clean([CleanOptions.FORCE, CleanOptions.RECURSIVE])
.reset(ResetMode.HARD, ['origin/HEAD'])
.checkout(defaultBranch)
.pull({
'--rebase': null,
})
} else {
try {
const currentBranch = await repoClient.revparse(['--abbrev-ref', 'HEAD'])
Expand Down

0 comments on commit 9f0a32e

Please sign in to comment.