Search code examples
gitvisual-studio-code

In Visual Studio Code How do I merge between two local branches?


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:

eGit options available in VSCode

Attempting to pull from a an alternate branch or push to an alternate branch yields:

git Command throttling

Here's the documentation on VSCode's Git Visual Studio Code Git Documentation

What am I overlooking?


Solution

  • 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

    https://code.visualstudio.com/assets/updates/1_18/merge.png

    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.