'How to disable git for some project and other project not disable git in Visual Studio Code?

some project i don't want use git monitoring , but in other project i want to keep use git monitoring , i use setting

"git.enabled": false,
"git.path": null,
"git.autofetch": false

but it will disable git for all project , so how to setting Visual Studio Code git for project instead of the editor?



Solution 1:[1]

You could add your git settings to the workspace settings.json file. That way, vscode would ignore git changes for only that project. Create or add to the .vscode/settings.json file.

"git.enabled": false

This way all of your other project will continue have git enabled.

Solution 2:[2]

To follow up with @alexriedl's answer, that snippet would be added into settings.json to apply for that workspace only:

{
    "git.enabled": false
}

Here's an example folder structure:

myproject/
??? .vscode/
?   ??? settings.json <----
??? html/
?   ??? index.html
?   ??? 404.html
??? js/
    ??? bootstrap.js
    ??? bootstrap.min.js

Solution 3:[3]

You could add * in your .gitignore file

#to ignore all project's file
*

Solution 4:[4]

A possible solution by simply using the VSCode UI:

  • right click on project name
  • click on "Open Folder Settings"
  • open "Extensions" then "Git"
  • scroll down until "Enabled - Whether git is enabled"
  • uncheck it

Solution 5:[5]

One quick workaround would be, for the projects you don't want Git monitoring, to rename the .git folder within that project codebase.

That would result in no Git feature visible, because the codebase would not be detected by VSCode as a Git repo.

Solution 6:[6]

You can remove .git folder in the project's root directory to disable git, by using:

rm -rf .git

Solution 7:[7]


first way :

  1. Open the command palette (either with F1 or Ctrl+Shift+P)
  2. Type "open settings"
  3. choose Open Settings (JSON)
  4. add "git.enabled": false to the settings.json file

second way :

  1. create .gitignore file in your project (maybe you already have it )
  2. add
* 
*/
  • to ignore all files in your project

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alexriedl
Solution 2 Jack Casey
Solution 3 J. Yapo
Solution 4 zeroquaranta
Solution 5 VonC
Solution 6 FSarter
Solution 7 monim