angulargitvisual-studio-2019source-control-explorer

Why does Visual Studio 2019 automatically setup git source control?


I set up a new Angular app with "ng new todo". Then I opened Visual Studio 2019. I selected open folder and opened the folder of the Angular app. I noticed the little green + icons next to all the files right away. Visual Studio 2019 seems to have automatically setup source control just by opening the folder in git in a local repository. Why did it do that? I don't want VS 2019 doing that automatically. I want to control how, when and where I set up my source control and repositories. Is there a way to unhook that and just kill the repository?


Solution

  • It isn't Visual Studio, it's Angular. The ng new command will create a new git repository. Visual Studio will show source-control annotations on Solution Explorer items if it detects a git repo.

    Use ng new --skip-git (or --skipGit=true) to prevent it from creating a new Git repo with ng new.

    Oddly, the integration with git isn't explicitly mentioned in the documentation for ng new https://angular.io/cli/new ) but the page does mention the command-line flags regarding git.