Source Control

Branches & Collaboration

Create, switch, and merge branches, and sort out the conflicts that show up when other people are in the same repo.

Branching

Click the branch name in the Status Bar (bottom-left) to open the branch picker. Switch to a branch you already have, create one from your current HEAD, or check out a remote branch that is not on your machine yet.

Syncing with a remote

Pull & Push

The sync icon in the Status Bar shows how many commits you are ahead or behind the remote. One click pulls, then pushes.

Publish Branch

A local branch with no upstream yet shows a Publish Branch action. It creates the matching remote branch and starts tracking it.

Fetch

Fetch From All Remotes updates your local view of remote branches. It does not merge anything into the branch you are on.

History graph

The Graph panel shows commits that would come in or go out relative to your remote, so you can see what a pull or push will do before you do it.

Resolving merge conflicts

When a merge, rebase, or pull hits a conflict, the files show up in a Merge Changes group in Source Control. Open one and you get a 3-way merge editor:

1

See both sides

The incoming version and the current version sit side by side, with the conflicting region highlighted in both.

2

Pick a resolution

Accept the current change, the incoming change, or both, or edit the result yourself in the combined view at the bottom. The buttons are in the editor, so you do not have to edit <<<<<<< markers by hand.

3

Mark as resolved

When every conflict in a file is handled, stage it like any other change and continue the merge or rebase.

Check the whole file before committing a merge

The 3-way editor clears conflict markers. Still read the merged result in context. A result can be valid syntax and still be the wrong behavior if both sides changed nearby code.

Working with GitHub

Sign in with a GitHub account from the Accounts icon in the Activity Bar. Push and pull can then authenticate without a personal access token. Extensions that talk to GitHub, such as pull request review or issue linking, can sign in the same way.