You can create new git repository while creating new project in Visual Studio. Yes, at the same time of new project created in Visual Studio. In that case, you really don’t need to initialize the repo separately post your project creation and you can start working with the repository directly. You can create a new Git repository at the same time we create the new project from the New Project Dialog Window.
Create new git repository while creating new project in Visual Studio
- Start a new instance of Visual Studio
- Launch the New Project Dialog Window by navigating from File -> New -> Project
- Select the Project Template and provide all other required information for project creation
- Select the “Create new Git Repository” checkbox
- Click on OK
And that’s it. Now we have created a new project, and it’s under a Git repository. You can now use the source code directly as your local git repository and further then push it to remote branches as needed.
This is a very straightforward way to connecting your solution with Git Repository. There are several other ways to enable this, but this is an overlooked feature which can make things faster and easier.
Hope this helps