Skip to content

Commit fbee61c

Browse files
ghogendenrea
andauthored
Version control local repo (#12943)
* Add info about local repos * Add info about local repos 2 * Incorp feedback * Acrolinx fix --------- Co-authored-by: Dennis Rea <[email protected]>
1 parent 97334cd commit fbee61c

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

docs/version-control/git-create-repository.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ To follow this article, you'll need:
4343
4444
1. After you sign in and enter your repo info, select the **Create and Push** button to create your repo and add your app.
4545

46-
### Open an existing local repository
47-
48-
After you’ve created a repo or [cloned one](git-clone-repository.md), Visual Studio detects the Git repository and adds it to your list of **Local Repositories** in the Git menu. From there, you can quickly access and switch between your Git repositories.
49-
5046
## Create an Azure DevOps repo
5147

5248
1. Open Visual Studio, and then select **Create a new project**.
@@ -62,6 +58,32 @@ After you’ve created a repo or [cloned one](git-clone-repository.md), Visual S
6258

6359
1. Select the **Create and Push** button to create your repo and add your app.
6460

61+
## Work with local repos
62+
63+
To create a local repo:
64+
65+
1. From the **Git** menu, select **Create Git Repository**.
66+
67+
1. In the **Create a Git repository** dialog, under **Other**, choose **Local only**.
68+
69+
:::image type="content" source="media/vs-2022/git-repository-create-local.png" alt-text="Screenshot of the Create Git Repository screen, showing the Local only option.":::
70+
71+
1. Under **Initialize a local Git repository**, check the local path to the project, and modify any other settings if needed.
72+
73+
1. Select the **Create and Push** button to create your repo.
74+
75+
After you’ve created a repo or [cloned one](git-clone-repository.md), Visual Studio detects the Git repository and adds it to your list of **Local Repositories** in the Git menu. From there, you can quickly access and switch between your Git repositories.
76+
77+
## Add another repo to a solution
78+
79+
When you add a new project to an existing multi-repo solution, you might want to track that project in its own repository. To do so, follow these steps:
80+
81+
1. Add the project to the solution.
82+
1. Close the solution.
83+
1. Use **Open a local folder** to open the new project by itself.
84+
1. Create a new repository using the methods described earlier in this article in GitHub, Azure DevOps, another Git hosting provider, or locally (the equivalent of `git init` from the command line).
85+
1. Reopen the parent solution. The new project's repo will be included.
86+
6587
## Related content
6688

6789
- [Create a branch](git-create-branch.md)
Loading

0 commit comments

Comments
 (0)