Skip to content

Commit f907fff

Browse files
committed
Use git reset instead of git pull to avoid attempting a merge commit
Also, use git remote set-head in case the repository’s default branch has been renamed. Fixes yarnpkg#5303. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 3119382 commit f907fff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util/git.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ export default class Git implements GitRefResolvingInterface {
320320
return fs.lockQueue.push(gitUrl.repository, async () => {
321321
if (await fs.exists(cwd)) {
322322
await spawnGit(['fetch', '--tags'], {cwd});
323-
await spawnGit(['pull'], {cwd});
323+
await spawnGit(['remote', 'set-head', 'origin', '--auto'], {cwd});
324+
await spawnGit(['reset', '--hard', 'origin/HEAD'], {cwd});
324325
} else {
325326
await spawnGit(['clone', gitUrl.repository, cwd]);
326327
}

0 commit comments

Comments
 (0)