Previously

In the previous article I talked about setting up an ASP.NET Razor website for this blog and how easy it is to do it in Visual Studio.

It's Alive

Intro & Goal

A collega and friend of mine, Sander, once said during a scrum meeting:

Don't Klingon the past, we have Source Control.
He always had these funny one-liners and we'd write them onto our Project board.

The goal of this article is to store the source code of this blog in a code repository of a Source Control solution.

Source Control

Source Control, aka Version Control is one of the most important parts of software development. You can't start a project without it. Well, actually you can, but without it, you can mess up a lot of things. In short, Source Control is software solution that keeps track of your code changes in time. Yes, it's like a time machine that allows you only to go back in time. Haha imagine, being able to travel forward. But use it with caution. beacuase a lot can go wrong when you or multiple people mess with the time line at the same time. You don't want tear a hole in the fabric of space and time. It's as bad as a DivideByZeroException, black hole material, stay away from it.

Version Control Documentation

Check What is version control? on Azure DevOps for more details and why it matters

There are many Source Control solutions at hand, but I favor the Azure DevOps git repositories to store my code. Azure DevOps is more than just code repositories, but I'm not going to deviate to any of the other features now.

Azure DevOps Documentation

Check Sign up for Azure DevOps to get a free Azure DevOps account in case you don't have one yet

I've had an online Azure DevOps account for many years now, back when it was still called Visual Studio Team Services. (VSTS). But even before that, I've been working with Microsoft Source Control solutions ever since I started developing.

First encounter

At my first job I came in contact with Microsoft Visual Sourcesafe, the first Source Control solution I ever tried. It wasn't bad at first sight, for simple applications. But once your code base was very large, you quickly saw that it wasn't capable of handling it correctly anymore, especially when there were multiple users working on the code base simultaniously. At some point, the software as discontinued. But Microsoft apparently still has Documentation for it.

All the companies I worked for as a consultant had some version of Team Foundation Server (TFS) on premise. I've always liked working with it. But it didn't even come close to the Git standard that Microsoft also adapted eventually. The last couple of customers were working with the git repo's in Azure DevOps, luckily.

Git Documentation

Check What is Git? on Azure DevOps

Creating a repository

My random-awesome-memory blog website has been setup, the first basic version is up and running locally. This obviously has to be stored in a code repository. You can create the code repository whenever you want, actually the sooner the better.

Azure Repos Documentation

Check Azure Repos Documentation for more information on repositories in Azure DevOps

It's as easy as navigating to your Azure DevOps account and creating a new repository in your DevOps project. When the repo has been created, you can clone it to your machine. Just push your code to the repository using your favorite IDE. For me, that's Visual Studio.

Azure Repos Documentation

Check Create a new Git repo in your project for more information on creating repositories in Azure DevOps

Conclusion

TADAAA, you're all set up to safely continue developing your project without having to fear you will lose something valuable. For now, I'm going to leave it to having just one branch, which is the main branch beacuase it's a very simple website. Later I'm going to implement some other best practices related to branching. Be sure to keep reading.

Documentation Reference

Next

In the next article I'm going to discuss how we can setup Azure hosting for this website.

Hosting the ASP.NET website in Azure