Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
strauss_d_getting_started_with_visual_studio_2022_learning_a.pdf
Скачиваний:
123
Добавлен:
26.06.2023
Размер:
17.04 Mб
Скачать

Chapter 5 Source Control

Figure 5-55.  Apply, pop, or drop the stash

Stashing allows me to pause the changes I was working with and carry on with something else for a while. Another great example of using stashes is when I am working on a branch, and I need to make a bug fix. I can stash my changes which will revert the code in my branch. Then I can make the bug fix and push that up to the remote repo before popping my stash back to my branch. Stashing allows developers to be very flexible when working with code changes.

Multi-repo Support

A new feature in Visual Studio 2022 is multi-repo support. You can now work in a single solution, with projects hosted in different Git repositories.

294

Chapter 5 Source Control

Figure 5-56.  Enable Preview Features

At the time of writing this book, multi-repo support had to be enabled from the Preview Features section in the Options window as seen in Figure 5-56.

Figure 5-57.  Multiple GitHub repos

I have two repositories in GitHub: one for my web application and a second for a Web API project as seen in Figure 5-57. With the multi-repo support option enabled, I can now open my web application in Visual Studio 2022 and then add an existing project by right-clicking the solution and selecting Add Existing Project and selecting my Web API project.

295

Chapter 5 Source Control

Figure 5-58.  Multi-repos open in Visual Studio

As seen in Figure 5-58, both my projects across both repositories are loaded in Visual Studio, and the repo in the status bar shows that I am working with two repositories.

296

Chapter 5 Source Control

Figure 5-59.  Changes in both repositories

As seen in Figure 5-59, I can make changes in both repositories and commit all these changes locally by clicking the Commit All Repos button.

Figure 5-60.  Changes committed locally

Once these changes are committed locally, I can’t just push them as seen in Figure 5-60. To accomplish this, I need to select the repos individually from the Repos drop-down (Figure 5-61) and push the changes one by one.

297