diff --git a/extensions/git/package.json b/extensions/git/package.json index cd9ea807d1f..0bf5d9afd34 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -193,8 +193,8 @@ "category": "Git" }, { - "command": "git.pullFromRemoteBranch", - "title": "%command.pullFromRemoteBranch%", + "command": "git.pullFrom", + "title": "%command.pullFrom%", "category": "Git" }, { @@ -327,13 +327,17 @@ "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { - "command": "git.pullFromRemoteBranch", + "command": "git.pullFrom", "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { "command": "git.pullRebase", "when": "config.git.enabled && scmProvider == git && gitState == idle" }, + { + "command": "git.pullFrom", + "when": "config.git.enabled && scmProvider == git && gitState == idle" + }, { "command": "git.push", "when": "config.git.enabled && scmProvider == git && gitState == idle" @@ -387,8 +391,7 @@ "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { - "command": "git.pullFromRemoteBranch", - "group": "1_sync", + "command": "git.pullFrom", "when": "config.git.enabled && scmProvider == git && gitState == idle" }, { diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 12f02512b18..199338a68e6 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -25,7 +25,7 @@ "command.merge": "Merge Branch...", "command.pull": "Pull", "command.pullRebase": "Pull (Rebase)", - "command.pullFromRemoteBranch": "Pull From...", + "command.pullFrom": "Pull from...", "command.push": "Push", "command.pushTo": "Push to...", "command.sync": "Sync", diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 334ec210714..c1615041dd3 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -810,7 +810,7 @@ export class CommandCenter { } } - @command('git.pullFromRemoteBranch') + @command('git.pullFrom') async pullFrom(): Promise { const remotes = this.model.remotes; diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 49906563fe2..d559bb36cc6 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -751,19 +751,16 @@ export class Repository { } } - async pull(rebase?: boolean, remote?: string, name?: string): Promise { + async pull(rebase?: boolean, remote?: string, branch?: string): Promise { const args = ['pull']; if (rebase) { args.push('-r'); } - if (remote) { + if (remote && branch) { args.push(remote); - } - - if (name) { - args.push(name); + args.push(branch); } try { diff --git a/extensions/git/src/model.ts b/extensions/git/src/model.ts index 8f161f4336c..25e9c6bcad7 100644 --- a/extensions/git/src/model.ts +++ b/extensions/git/src/model.ts @@ -501,6 +501,10 @@ export class Model implements Disposable { await this.run(Operation.Push, () => this.repository.push()); } + async pullFrom(rebase?: boolean, remote?: string, branch?: string): Promise { + await this.run(Operation.Pull, () => this.repository.pull(rebase, remote, branch)); + } + async pushTo(remote?: string, name?: string, setUpstream: boolean = false): Promise { await this.run(Operation.Push, () => this.repository.push(remote, name, setUpstream)); }