skip to Main Content

Just curious what the official workflow for this is. I haven’t found a smooth and easy way to retrieve a specific remote branch using the VS Code UI. I can do it from the command line, of course, but it seems like there’s no way to do this using the VS Code UI.

For instance, if I haven’t yet checked a remote branch onto my local, it simply doesn’t appear in VS Code no matter how many times I pull or fetch.

Can anyone point me in the right direction here?

2

Answers


  1. In the branches section of the Source Control tab, click the "Switch to Another Branch" button:

    switch branches button

    After doing that, a drop down should appear with your local and remote branches for you to switch to:

    drop down of branches

    Login or Signup to reply.
  2. You can checkout a remote branch and automatically create a local, remote-tracking branch for it by using the Git: Checkout To... command in the command palette. It will open a menu first prompting you to select a repository if your workspace has multiple repositories, and then prompt you to select a branch to check out (remote branches will be shown in a dedicated sectio).

    You can checkout a remote branch without creating a local, remote-tracking branch by using the Git: Checkout To (Detached)... command in the command palette. There’s also a status bar indicator of the current branch that you can click to open up the same menu.

    Of course, you’ll need to git fetch to update your local repository’s knowledge of what remote branches exist and what commit they point to. (VS Code has a corresponding Git: Fetch command you can use the command palette).


    if I haven’t yet checked a remote branch onto my local

    I have never heard of this terminology. I assume you mean you haven’t made a remote-tracking branch in your local clone.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search