Getting Started with Version Control: A Beginner's Guide

This beginner version control guide introduces network engineers to Git, covering installation, repository creation, the add-commit-push workflow, and best practices for managing automation code. It maps directly to CCNA DevNet exam objective 1.7 and is designed for those new to code management.

Getting Started with Version Control: A Beginner's Guide

If you've ever saved a file as config_final.txt, then config_final_v2.txt, then config_final_ACTUALLY_FINAL.txt, you already understand the problem that version control solves. For network engineers stepping into automation, version control is one of the most important habits to build early. This beginner version control guide will walk you through what it is, why it matters, and how to start using it today.

What Is Version Control?

Version control is a system that tracks changes to files over time. Instead of manually duplicating files, a version control system (VCS) records every change you make, who made it, and when. If something breaks, you can roll back to a working state in seconds.

The most widely used VCS today is Git. It's free, open source, and the foundation of platforms like GitHub and GitLab. For Cisco DevNet Associate (DEVASC 200-901) candidates, Git is explicitly covered under exam objective 1.7, so understanding it is both practical and exam-relevant. Note that this is the DevNet Associate certification, which is separate from the CCNA, though many network engineers pursue both as they move into automation roles.

Why Network Engineers Need Version Control

Think about what you're managing as a network automation engineer: Python scripts, Ansible playbooks, Jinja2 templates, and API payload files. Without version control:

Version control fixes all of that. It's a foundational code management habit that separates hobbyist scripting from professional automation work.

Installing Git

On most Linux systems, Git is either pre-installed or one command away:

sudo apt install git        # Debian/Ubuntu
sudo yum install git        # CentOS/RHEL

Verify it worked with:

git --version

You should see output like git version 2.39.2. Once installed, configure your identity. Git attaches your name and email to every change you commit:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Your First Repository

A repository (or "repo") is just a folder that Git is tracking. Let's create one for a simple network automation project:

mkdir net-automation
cd net-automation
git init

You'll see: Initialized empty Git repository in /home/user/net-automation/.git/

Now create a simple Python file:

touch check_device.py

Check the status of your repo at any time with:

git status

The Three-Step Workflow: Add, Commit, Push

This is the core version control loop you'll use constantly:

  1. Stage your changes: Tell Git which files to include in the next snapshot.
  2. Commit your changes: Save that snapshot with a descriptive message.
  3. Push to remote: Upload your changes to a platform like GitHub.

In practice, it looks like this:

# Stage a specific file
git add check_device.py

# Stage everything in the folder
git add .

# Commit with a meaningful message
git commit -m "Add initial device connectivity check script"

# Push to GitHub (after setting up a remote)
git push origin main

That commit message matters more than people think. Write it like a headline: short, specific, and in the present tense. "Add Netmiko SSH script for IOS-XE" is far more useful than "updated stuff."

Viewing History and Undoing Mistakes

One of Git's most valuable features is the ability to see exactly what changed and recover from errors. Use git log to see your commit history:

git log --oneline

Sample output:

a3f9c12 Add Netmiko SSH script for IOS-XE
7b2e041 Add initial device connectivity check script

If you need to undo uncommitted changes to a file:

git checkout -- check_device.py

And if you need to revert an entire commit, you can use git revert to safely undo it without rewriting history, which is especially important when collaborating with others.

Best Practices for Beginners

  • Commit often: Small, frequent commits are easier to understand and debug than massive ones.
  • Use a .gitignore file: Exclude files like passwords, API keys, and __pycache__ directories from your repo.
  • Never commit credentials: Use environment variables or a secrets manager instead.
  • Write meaningful commit messages: Future you will thank present you.
  • Use branches for experiments: Create a new branch before trying something risky, so main stays stable.

For deeper reading on Git within the DevNet context, the Cisco Press DevNet Associate DEVASC 200-901 Official Cert Guide covers version control thoroughly alongside the other exam objectives.

What's Next

Now that you understand the basics of Git and can commit code locally, the next step is working with remote repositories on platforms like GitHub. In the next post, we'll cover cloning repos, working with branches, and submitting pull requests. These skills move you from solo version control into collaborative automation workflows, which is exactly what professional network engineering teams use every day.

🔧
For writing and managing your automation scripts locally, a good code editor makes a huge difference — VS Code is free, has built-in Git integration, and is widely used across the network automation community. VS Code, PyCharm and Sublime Text.