diff --git a/src/env/node/git/git.ts b/src/env/node/git/git.ts index dd34bf13142af..cdffa4842423b 100644 --- a/src/env/node/git/git.ts +++ b/src/env/node/git/git.ts @@ -1024,7 +1024,7 @@ export class Git { async pull( repoPath: string, - options: { branch?: string; remote?: string; rebase?: boolean; tags?: boolean }, + options: { branch?: string; remote?: string; upstream?: string; rebase?: boolean; tags?: boolean }, ): Promise { const params = ['pull']; @@ -1038,7 +1038,7 @@ export class Git { if (options.remote && options.branch) { params.push(options.remote); - params.push(options.branch); + params.push(options.upstream ? `${options.upstream}:${options.branch}` : options.branch); } try { diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index f0a26c83dbe87..b600bf9981a99 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -1461,11 +1461,10 @@ export class LocalGitProvider implements GitProvider, Disposable { if (options.publish != null) { branchName = options.reference.name; remoteName = options.publish.remote; - upstreamName = getBranchTrackingWithoutRemote(options.reference); } else { [branchName, remoteName] = getBranchNameAndRemote(options.reference); - upstreamName = undefined; } + upstreamName = getBranchTrackingWithoutRemote(options.reference); } else { const branch = await this.getBranch(repoPath); if (branch == null) return; @@ -1558,6 +1557,7 @@ export class LocalGitProvider implements GitProvider, Disposable { await this.git.pull(repoPath, { branch: branchName, remote: remoteName, + upstream: getBranchTrackingWithoutRemote(branch), rebase: options?.rebase, tags: options?.tags, });