Reputation: 3464
In Visual Studio Code it seems that I am only allowed to push, pull and sync. There is documented support for merge conflicts but I can't figure out how to actually merge between two branches. The Git command line within VSC (press F1) only facillitates a subset of commands:
Attempting to pull from a an alternate branch or push to an alternate branch yields:
Here's the documentation on VSCode's Git Visual Studio Code Git Documentation
What am I overlooking?
Upvotes: 157
Views: 301289
Reputation: 117
Step-by-step guide to Git repository setup, making changes, and merging branches (see Step 4); moving my previous comment (TLDR) into an answer for completeness.
This is detailed in Step 4.
In Visual Studio Code, if a repository (repo) has not already been created you can either Initialise a local repo or Clone from a remote repo:
Make changes and commit according to Step 1, A. 3, 4, 5, 7.
Alternatively, in the the Source Control pane, click the 3 dots (...) menu of the Source Control heading and navigate to the option.
For more info check out: VS Code overview
Upvotes: 2
Reputation: 1323573
Update June 2017 (from VSCode 1.14)
The ability to merge local branches has been added through PR 25731 and commit 89cd05f: accessible through the "Git: merge branch
" command.
And PR 27405 added handling the diff3-style merge correctly.
Vahid's answer mention 1.17, but that September release actually added nothing regarding merge.
Only the 1.18 October one added Git conflict markers
From 1.18, with the combination of merge command (1.14) and merge markers (1.18), you truly can do local merges between branches.
Original answer 2016:
The Version Control doc does not mention merge commands, only merge status and conflict support.
Even the latest 1.3 June release does not bring anything new to the VCS front.
This is supported by issue 5770 which confirms you cannot use VS Code as a git mergetool
, because:
Is this feature being included in the next iteration, by any chance?
Probably not, this is a big endeavour, since a merge UI needs to be implemented.
That leaves the actual merge to be initiated from command line only.
Upvotes: 57
Reputation: 7551
You can do it without using plugins.
In the latest version of vscode that I'm using (1.17.0) you can simply open the branch that you want (from the bottom left menu) then press ctrl+shift+p
and type Git: Merge branch
and then choose the other branch that you want to merge from (to the current one)
Upvotes: 207
Reputation: 1206
I had the same question, so I created Git Merger.
hope this helps :)
Upvotes: 32
Reputation: 567
I found this extension for VS code called Git Merger. It adds Git: Merge from
to the commands.
Upvotes: 8