Home > Software engineering >  Where is the .git folder of a MS Visual Studio solution?
Where is the .git folder of a MS Visual Studio solution?

Time:10-05

I have used Git directly from within the MS Visual Studio. I want to be able to open the Git repository on its own in SoureTree or interact with it using the command-line Git through a terminal outside the MS Visual Studio. However, I cannot find the .git folder anywhere inside the MS Visual Studio solution folder.

CodePudding user response:

The .git folder doesn't have to be the same directory as your VS solution folder. In one of my repos I have hundreds of VS solutions. The repo root is quite a few levels up from any of them.

If you're currently in a VS solution that is tracked by Git, there a multiple ways to find your repo root. Some of the simplest are:

  1. At the bottom right of Visual Studio you should see the repo and branch name. Hover over the repo to see the root path.
  2. When looking at any commit, the files will list their entire path, starting from the root of the repo.
  3. In Solution Explorer, click on the button "Switch between solutions and available views", and your solution will switch to "Folder View" which will display the location of your repo at the top, and all of the files in it.

CodePudding user response:

Naturally, the .git folder is in you home directory, but hidden. In the .vscode folder, there only is argv.json and the extensions folder.

  • Related