diff --git a/CHANGELOG.md b/CHANGELOG.md index 5352fb2..844a218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p ### Fixed +- Fixes [#1285](https://github.com/eamodio/vscode-gitlens/issues/1285) - Uncommitted staged changes after pull - Fixes [#1294](https://github.com/eamodio/vscode-gitlens/issues/1294) - Error when open commits list ## [11.1.0] - 2020-12-23 diff --git a/src/commands/git/pull.ts b/src/commands/git/pull.ts index 9d4faae..064ad7f 100644 --- a/src/commands/git/pull.ts +++ b/src/commands/git/pull.ts @@ -1,6 +1,6 @@ 'use strict'; import { Container } from '../../container'; -import { GitBranchReference, GitReference, Repository } from '../../git/git'; +import { GitBranch, GitBranchReference, GitReference, Repository } from '../../git/git'; import { appendReposToTitle, PartialStepState, @@ -57,9 +57,15 @@ export class PullGitCommand extends QuickCommand { }; } - execute(state: PullStepState) { + async execute(state: PullStepState) { if (GitReference.isBranch(state.reference)) { - return state.repos[0].fetch({ branch: state.reference }); + // Only resort to a branch fetch if the branch isn't the current one + if (!GitBranch.is(state.reference) || !state.reference.current) { + const currentBranch = await state.repos[0].getBranch(); + if (currentBranch?.name !== state.reference.name) { + return state.repos[0].fetch({ branch: state.reference }); + } + } } return Container.git.pullAll(state.repos, { rebase: state.flags.includes('--rebase') });