Chapter 8. Source Control with Git

So far in this book, we’ve shown you lots of ways to add automation to your toolbox, whether via scripting languages like Python (see Chapter 4) or via templating languages like Jinja (see Chapter 6). The increased use of Python-based scripts or Jinja templates means that managing these artifacts (and by artifacts we mean the files that make up these scripts, templates, and other automation tools you’re employing) is very important. In particular, managing the changes to these artifacts has significant value (we’ll explain why shortly).

In this chapter, we’re going to show you how to use a source control tool—that is, a tool that is designed to manage the artifacts you’re creating and using in your network automation processes. The use of a source control tool lets you avoid messy and error-prone approaches like appending date- and timestamps to the end of filenames, and keeps you from running into accidentally deleted or overwritten files.

To start things out, let’s take a closer look at the idea of source control. We’re going to keep the discussion fairly generic for now; we’ll delve into a specific source control tool known as Git later in the chapter. The generic qualities discussed in the next section are not specific to any particular source control tool, however.

Use Cases for Source Control

Simply put, source control is a way of tracking files and the changes made to those files over time (source control is also known ...

Get Network Programmability and Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.