Questions tagged [vscode-git]

For questions about using Visual Studio Code GUIs for Git-related operations, may it be doing Git commands via the Source Control UI or the command palette, viewing diffs, resolving merge conflicts, or making commits. For general Git-related questions about the git commands themselves, use the [git] tag instead.

Visual Studio Code comes with a built-in source control management system, and supports Git out-of-the-box as its default SCM provider. See: https://code.visualstudio.com/docs/editor/versioncontrol#_git-support.

As an alternative to using Git from the command line, many of the Git commands can also be done from the Source Control UI, especially since the updates from VS Code 1.48.

VS Code Source Control UI

The same commands can also be done via the command palette.

VS Code Command Palette > Git

There are also GUIs for visualizing certain Git-related operations, such as viewing diffs, resolving merge conflicts, making commits, and for viewing a timeline of changes to a file.

This tag is for questions asking about any of of these features in relation to performing the correct Git commands or operations. Please make sure to clearly describe which parts of the UI or which commands on the Command Palette you are referring to.

For general Git-related questions about using Git from the command line independently from the UI, use the more general . This is because for general Git-related questions, they are most likely unrelated to VS Code itself.

22 questions
126
votes
5 answers

How to change VS Code's merge conflict layout?

I use VS CODE for version control (using git). Every time I had a conflict, VS CODE showed me with a layout where I could see all the changes in one window: However, with no advice, it change to a weird 3 windowed design where I can't understand…
35
votes
4 answers

Visual Studio Code: Review Merge Changes Side by Side, rather than top down

Is there any way to compare file changes in Visual Studio Code Side By Side, rather than top down? Regular Visual Studio Enterprise has this option. This is during git merge conflict resolution.
mattsmith5
  • 540
  • 4
  • 29
  • 67
34
votes
2 answers

How to disable/turn off 3-way merge editor view in VSCode?

Until recently, in VSCode, handling merge conflicts was simple (to me, at least): Accept Current Change, Accept Incoming Change, Accept Both Changes, Compare Changes. It used to be something like this: source However, from v1.70 onwards, it's…
Milan
  • 1,743
  • 2
  • 13
  • 36
12
votes
4 answers

Why is Visual Studio Code's Git showing all changes on drive?

I am using Visual Studio Code 1.6.0 on a Macbook. I'm finding that the VS Code's Git is listing tons of changes - even ones that are not in my working folder? When I hover over these I get a tooltip: This file is located outside the current…
Dr T
  • 504
  • 1
  • 7
  • 20
4
votes
3 answers

How to ignore changes in leading/trailing whitespace in a non-diff editor?

With "diffEditor.ignoreTrimWhitespace": false, changes in a diff editor: With "diffEditor.ignoreTrimWhitespace": true, changes in a diff editor: With "diffEditor.ignoreTrimWhitespace": true, changes in a normal (non-diff) editor: How to ignore…
Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
3
votes
1 answer

HEAD is not initialized at vscode extension startup

I need to get the commit hash from the HEAD for each workspace when loading my extension, at vscode startup. For some reason, the HEAD was not initialized at boot time. If I add a 1 second sleep, then HEAD becomes initialized. Why is this happening?…
2
votes
0 answers

Is there any shortcut for focusing on specific repository in VSCode source control side bar

In vscode, I use a multi-root workspace with 40+ different git repositories. I use vscode source control extensively. My current workflow is to scroll through the source control repositories to find the correct repository and click on it. This could…
navidda
  • 21
  • 4
2
votes
2 answers

Git merge conflict window doesn't show in VSCode (CodeLens)

I have git version 2.32.0.windows.2, VSCode version 1.68.1 and CodeLens doesn't show up when there are conflicts. Git recognizes the conflicts but VSCode somehow fails to show me the conflict so I can't manage it with CodeLens. The image is not…
2
votes
2 answers

GIT merge with conflicts generated message appears

I am learning how to work with Git. On windows with VS Code. I am learning merge with conflicts. After resolving commit conflicts, I will see an auto-generated commit message containing a list of conflicting files. It opens automatically in the…
LAMBARZOL
  • 23
  • 3
1
vote
1 answer

Make vscode's git integration cancel push if behind remote (instead of automerging)?

I have been using Atom's git integration for a long time. Now that it's gone obsolete, I switched to vscode, whose git integration is if not terrible in comparison, at least different. One of the differences is that when I'm behind the remote and…
Gouvernathor
  • 92
  • 1
  • 12
1
vote
2 answers

how to delete duplicate local branch in git which does not exist

I searched for similar questions posted here and on the web, but none of them refer to my case. In some way, I accidentally created a duplicate local branch as you can see in the attached screenshot. My guess is that I created it somehow when I was…
mhadar
  • 49
  • 4
0
votes
0 answers

Push all git repos sequentially, in vscode multiroot workspace

I use a multiroot workspace in vscode. In the source control sidebar, I can commit changes and push to origin (for each repo). But often I have to push multiple repos. Although I can click the "Sync Changes" button for each repo: I can't push too…
lonix
  • 14,255
  • 23
  • 85
  • 176
0
votes
1 answer

How do I keep my local settings file from uploading to Github whilst maintaining a sample?

I'm using VS Code to manage my project and sync with GitHub. In my config file, I have some API keys and endpoints which I do not want to make public, yet, I would like to maintain a version of the same file with dummy values in the project on…
0
votes
1 answer

How can I open an editor gutter's inline diff peek view in VS Code with keyboard shortcut?

In VS Code there's information in the gutter regarding the git status of each line, that looks like so: If you click in the gutter, this expands a menu that shows the diff locally, like so: Is there any way to open the previous menu without…
0
votes
0 answers

Cannot commit or see changes in SCM pane of VS Code - one project only

I have recently stopped seeing updates in the SCM pane in VS Code for one project only. It detects the repository, detects the changes, I can go into the ... menu to perform the usual tasks I do in the pane like Stage, Commit, and Push, but neither…
billoverton
  • 2,705
  • 2
  • 9
  • 32
1
2