I started working on my home automation project in 2020. I started with a simple backup script that copies the source code to a second hard drive, just in case the primary hard drive fails. When my code base started to grow I extended the script to create a (daily) second copy on OneDrive. From a backup perspective this is working fine, but it does not give me versioning and source control. Luckily, Github exists. Microsoft developed a Github extension for Visual Studio.
Make sure you update your Visual Studio installation before you install the extension. Additionally you need a Github account. After that, publishing an existing project to Github is pretty straightforward. Open the project, click File, Add to Source Control, and Visual Studio will offer you to create a new Github repository.
Login to your Github account, and fine a suitable name for your project.
Once you have published the project on Github you need to maintain it. There are three steps required to upload changes to the Github repository:
- Pull: pulls the latest version of the repository to the local development machine.
- Commit: commits the code changes to a “snapshot” of your project.
- Push: pushes the latest snapshot of your project to the repository.