Why Use Source Control

Source control, whether you’re writing one off scripts or automating intricate processes, is essential to your work. Simply keeping copies of your files scattered across your computer is not good enough. Source control will save you when you can’t figure out what changes you made that caused errors, when you can’t find the current version of your script, or when you have to work with a co-worker on you need to collaborate.

Tracking Changes

First and foremost, you want to know what changes you’ve made over time, especially when a change you’ve made in production is producing errors. Simply comparing two text files by hand isn’t how developers check for bugs and neither should IT Pros. Good source control will show you exactly what has changed between two versions of your code and allow you to revert back to the working file. This concept is called atomic changes and allows you to see exactly what changed over time.


Git was created by Linus Torvalds, yes, the Linus Tarvolds that created the Linux kernel. Linus was unhappy with the source control that the Linux kernel was kept in so he wrote his own.

The PowerShell community uses Git and Microsoft is even releasing components of PowerShell on Github as the PowerShell Team. If you’re wondering which source control system to use, just pick Git.

Git for Windows even bundles some great unix applications so you can use Grep, ssh, and vim from your Windows command prompt.


As mentioned before, Microsoft is publishing PowerShell code on Github for anyone to make a change. If you don’t like how a DSC resource works, make a change and ask them to accept your changes. Boom, you’ve contributed to the PowerShell ecosystem.

More likely, your sharing code between co-workers while on the job. Without source control you’re likely unable to tell who made what change and for what reason. Source control also gives you auditing features that simple file management doesn’t give you.

Automatic Testing

Imagine the entire business running off of an automation you wrote. You provision new customers from the ERP system quickly and it allows sales to increase their changes of landing big deals. The whole company relies on your script to run constantly but now your boss tells you the company needs a new feature to your automation. How do you know if any changes you make break the functionality of your script?

The answer is, testing. You can sit there and run your script through all different sorts of tests by hand, or you can leverage source control and automatic testing to make sure you haven’t broken anything. Windows 10 shipped with the Pester testing framework and if you know how to write the tests correctly you can know with certainty that your code changes won’t break production.

Once you have your changes tested make sure they run atomatically. Jenkins, GitLab CI, AppVeyor, and many others allow you to grab your code, run your tests, and let you know automatically if they cause errors or not. Collaborating with someone? These systems can check their code before you incorporate it into yours, that way you don’t bring in any breaking changes.

Time To Start

It is time to learn Git and source control in general. Check out Mike F. Robbins blog post Getting Started with the Git Version Control System, Warren Frame’s post GitHub For PowerShell Projects, as well as Warren’s TechSession Webinar A Crash Course in Version Control and Git.