Chapter 11. 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 6) or via templating languages like Jinja (see Chapter 9). The increased use of Python-based scripts or Jinja templates means that managing these artifacts is important (and by artifacts we mean the files that make up these scripts, templates, and other automation tools you’re employing). 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 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, let’s take a closer look at the idea of source control. We’ll keep the discussion fairly generic for now and 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.

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 as version control or revision control). We know that’s a really ...

Get Network Programmability and Automation, 2nd Edition 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.