On the GIT tab in Visual Studio Code there is an context menu with these items:
==================
==================
...
What does the publish button do?
After checking the source code of Visual Studio Code.
Push the current branch to the default remote upstream
public run(context?: any):Promise {
return this.gitService.push() // ... removed for brevity
}
There is UPSTREAM and recent push/pulls (ahead)
if (!HEAD || !HEAD.name || !HEAD.upstream) {
return false;
}
if (!HEAD.ahead) { // no commits to pull or push
return false;
}
Allows you to choose which remote you want to push to.
public run(context?: any):Promise {
const model = this.gitService.getModel();
const remotes = model.getRemotes();
const branchName = model.getHEAD().name;
let promise: TPromise<string>;
if (remotes.length === 1) {
const remoteName = remotes[0].name;
promise = TPromise.as(result ? remoteName : null);
} else {
// open the option picker
promise = this.quickOpenService.pick(picks, { placeHolder })
.then(pick => pick && pick.label);
}
return promise
.then(remote => remote && this.gitService.push(remote, branchName, { setUpstream: true }))
}
There is NO UPSTREAM and off course remote branches are set.
if (model.getRemotes().length === 0) {
return false;
}
if (!HEAD || !HEAD.name || HEAD.upstream) {
return false;
}