This blog post is just an observation from my experiences of getting the latest version of code from a remote development feature branch cloned from the main branch. I didn’t observe this my first sight and because of couple of other issues, I had overseen this, spent over a half an hour and I had to giggle after knowing this.
If you were aware, as of my last update in September 2021, Azure DevOps and Visual Studio have been integrated to support seamless code collaboration and version control.
So usually in day-to-day activities of any Developer working Microsoft Technology stack, Pull, Push, Clone, Merge of Azure DevOps repository directly from Visual Studio is quite common.
Usually, to clone a repository from Azure DevOps, you follow the below steps.
Step 1: Open Visual Studio of any
version, preferably after VS 2017
Step 2: Click on Clone the repository.
Step 3: Enter the Azure DevOps
Repository URL and provide the path in the prompt.
Step 4: Select your respective
repository and click on Sign in
Step 5: Once you are done click on
Clone, all your source code is now available in your IDE (Visual Studio)
There might be cases when you check and see you were not able to get the latest changes from your feature branch, those were present in the repo but not in your Visual Studio. Closing the Visual Studio and redoing the Cloning process didn’t help. Then I thought it could be because of Cache of Visual Studio in my PC, so I tried clearing cache following my favorite blog post written earlier in this blog. Even this didn’t help either, thanks to my buddy Mallikarjun C who gave me the clue and here it goes.
Whenever you were cloning a solution using above approach, ideally you will be checked out to the Main branch and not the feature branch which you were expecting to be checked out to, as Main is set as Default branch.
If you just see below, it wasn’t checked out to Develop, instead it was main. By default, with this approach, you will by default checked out to main branch.
Hence you were seeing the changes of the main branch itself and not the Develop branch.
Instead of this, as I learned I suggest you clone directly to your favorite IDE from Azure DevOps itself in few clicks.
Step 1: While you are in your respective branch in Azure DevOps, click on Clone option as highlighted below.
Step 2: It will then ask you to choose the IDE to which you can download the source code.
Hope this helps someone figuring this out..