diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 37c500f7605..0e3e19792cc 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -418,6 +418,7 @@ export class CommandCenter { return; } + const isRebasing = Boolean(repo.rebaseCommit); type InputData = { uri: Uri; title?: string; detail?: string; description?: string }; const mergeUris = toMergeUris(uri); @@ -425,14 +426,17 @@ export class CommandCenter { const theirs: InputData = { uri: mergeUris.theirs, title: localize('Theirs', 'Theirs') }; try { - const [head, mergeHead] = await Promise.all([repo.getCommit('HEAD'), repo.getCommit('MERGE_HEAD')]); + const [head, rebaseOrMergeHead] = await Promise.all([ + repo.getCommit('HEAD'), + isRebasing ? repo.getCommit('REBASE_HEAD') : repo.getCommit('MERGE_HEAD') + ]); // ours (current branch and commit) ours.detail = head.refNames.map(s => s.replace(/^HEAD ->/, '')).join(', '); ours.description = head.hash.substring(0, 7); // theirs - theirs.detail = mergeHead.refNames.join(', '); - theirs.description = mergeHead.hash.substring(0, 7); + theirs.detail = rebaseOrMergeHead.refNames.join(', '); + theirs.description = rebaseOrMergeHead.hash.substring(0, 7); } catch (error) { // not so bad, can continue with just uris @@ -442,8 +446,8 @@ export class CommandCenter { const options = { base: mergeUris.base, - input1: theirs, - input2: ours, + input1: isRebasing ? ours : theirs, + input2: isRebasing ? theirs : ours, output: uri };