GitHub Desktop and Azure DevOps
A peer of mine recently asked about how I manage local code (projects, solutions, Git repos, etc.) that may or may not be synced to a cloud repository (GitHub, Azure DevOps, etc.) Since I previously blogged about How I Blog – Updated 2018 and I’m a fan of re-using how many keys I have left I thought I would share my personal local development process. Show DisclaimerI like to to tell people that “I play a developer on TV”, meaning it has been at least 10 years since I’ve written code as a consultant that was actually deployed to a production system. Sure I’ve written (or collaborated on) many samples (ex. .Net Core console sample for Microsoft Graph) and proof of concepts for customers these past 10 years, but it wasn’t the primary focus of my job. So balance everything that I share with what others such as my friend Steve Smith (@Ardalis) share on his Weekly Dev Tips blog and podcast. Local Folder StructureCurrently I develop on Windows so folders and paths will reflect that. I don’t use the default folder that any of the IDEs or tools below use (generally under my user profile folder such as “c:\Users\[username]\…”). Instead I create a new folder called Projects at the root of my primary drive (i.e. “c:\Projects”). Below that folder I then have the following:
Using the underscore for _DevOps and _GitHub means that those folders should be easy to find at the top of this folder structure even if I happen to inadvertently sort the folder. As for project folders, I’ve thought about subdividing based on topic (ex. SharePoint Online, Azure, Microsoft Graph, etc.) or technology (ex. ASP.NET Core, Blazor, Console, etc.) but since I rarely have a large number of folders I haven’t done anything yet. I do name my folders and projects based on topic though (ex. BTJ.SPO.ProjectName, BTJ.AZ.ProjectName, BTJ.MG.ProjectName, etc.) This helps at least group together similar projects. Git / GitHub / Azure DevOps ToolsI use a mix of the following tools to sync my repos and monitor issues or pull requests.
ConclusionI hope you have found something useful in this post. Please share your own suggestions or recommended tools / processes in the comments below. Happy coding! -Frog Out
Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018 - TFS 2013 Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 You can create a local copy of a remote Git repo by cloning it into a local folder on your computer. Cloning a remote repo downloads all commits on all branches of the repo, unless you use the --single-branch clone option. Cloning links each branch in your new local repo with the corresponding branch in the remote repo. That way, when you push to share your local branch changes with your team, the corresponding remote branch is updated. Similarly, when you pull to update your local branch with changes made by your team, updates from the corresponding remote branch are retrieved. The remote repo can be an Azure Repos Git repo, a GitHub repo, or other hosted Git repo. This article provides procedures for the following tasks:
For an overview of the Git workflow, see Azure Repos Git tutorial. Prerequisites for access to Azure Repos
Get the clone URL of an Azure Repos Git repoTypically, you need to know the clone URL of the remote repo that you want to clone. The clone URL uniquely identifies the remote repo.
Note When you're signed into an Azure DevOps project, Visual Studio supports searching for and cloning project repos without needing to know the clone URL.
Get the clone URL of a GitHub repoTypically, you need to know the clone URL of the remote repo that you want to clone. The clone URL uniquely identifies the remote repo.
Note When you're signed into GitHub, Visual Studio supports searching for and cloning GitHub repos without needing to know the clone URL.
Clone an Azure Repos Git repoBy signing in as a member of an Azure DevOps project, you can clone private repos that are accessible to you, and public repos. Visual Studio supports search, clone, and sync operations on repos that are accessible through authentication.
Visual Studio 2019 version 16.8 and later versions provides a Git version control experience while maintaining the Team Explorer Git user interface. To use Team Explorer, uncheck Tools > Options > Preview Features > New Git user experience from the menu bar. You can use Git features from either interface interchangeably. Below, we provide a side-by-side comparison for cloning an Azure Repos Git repo.
Visual Studio Team Explorer
After you've cloned a remote Git repo, Visual Studio detects the local clone and adds it to the list of Local Repositories in the Git menu.
To clone an Azure Repos Git repo from the command line, see Clone any Git repo. By signing into GitHub or using SSH authentication, you can clone private repos that are accessible to you, and public repos. Visual Studio supports search, clone, and sync operations on repos that are accessible through authentication.
Note You can clone a public GitHub repo without signing in to GitHub or otherwise authenticating. To clone a public Git repo without signing in, see Clone any Git repo.
Visual Studio 2019 version 16.8 and later versions provide a Git version control experience that supports search, clone, and sync operations on GitHub repos that are accessible through authentication. To clone a GitHub repo using Team Explorer, see Clone any Git repo. The following steps apply to the Git version control experience.
After you've cloned a remote Git repo, Visual Studio detects the local clone and adds it to the list of Local Repositories in the Git menu.
To clone a GitHub repo using Team Explorer, see Clone any Git repo. To clone a GitHub repo from the command line, see Clone any Git repo.
Note You can also clone a GitHub repo from the command line by using the GitHub CLI. You can clone any Git repo that's accessible to you by using the clone URL of the repo.
Visual Studio 2019 version 16.8 and later versions provides a Git version control experience while maintaining the Team Explorer Git user interface. To use Team Explorer, uncheck Tools > Options > Preview Features > New Git user experience from the menu bar. You can use Git features from either interface interchangeably. Below, we provide a side-by-side comparison for cloning any Git repo.
Visual Studio Team Explorer
After you've cloned a remote Git repo, Visual Studio detects the local clone and adds it to the list of Local Repositories in the Git menu.
The Git clone command also let's you specify a folder path after the clone URL to create the repo in a specific location. For example: git clone https:///fiber-teams/FiberTests/_git/FiberTests C:\Repos\FiberTestsThe Git clone command also let's you clone just a single branch. This option is useful when only one branch of a large repo is of interest to you. git clone
Note When you clone a remote repository, Git assigns the alias origin as shorthand for the URL of the remote repo you cloned. Git commands often use that alias.
Visual Studio 2019 version 16.8 and later versions provides a Git version control experience while maintaining the Team Explorer Git user interface. To use Team Explorer, uncheck Tools > Options > Preview Features > New Git user experience from the menu bar. You can use Git features from either interface interchangeably. Below, we provide a side-by-side comparison for opening a Visual Studio solution from a cloned repo.
Visual Studio Team Explorer
In the Home view in Team Explorer, double-click your project solution file in the Solutions area. The solution opens in Solution Explorer. At the command prompt, run the following command to open a Visual Studio solution from a cloned repo. This command isn't a Git command. startFor example: start C:\Repos\FiberTests\FiberTests.sln
|