In Visual Studio Code How do I merge between two local branches?
GitVisual Studio-CodeGit Problem Overview
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?
Git Solutions
Solution 1 - Git
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)
Solution 2 - Git
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.
Solution 3 - Git
I had the same question, so I created Git Merger.
hope this helps :)
Solution 4 - Git
Solution 5 - Git
I found this extension for VS code called Git Merger. It adds Git: Merge from
to the commands.