🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Data Management / Database Administration › Bash Automation for Database Administration › Lesson 8
TEC-DATA86-09 · Lesson 8 · 12 clock hours · practice

Git Version Control for DBA Automation Libraries

Objective. Students will initialize a Git repository, commit all course scripts with descriptive messages and a README, manage branches for script versions, and demonstrate a pull-request-style review workflow appropriate for a professional DBA team.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Why Version Control Matters for DBA Teams

Database automation scripts are production assets. A backup script that runs every night, a maintenance job that rebuilds indexes, or a monitoring alert that pages on-call staff—all of these carry real risk if they change without a record. Git gives your team a complete, auditable history of every change: who made it, when, and why. For a DBA, that audit trail is as important as the scripts themselves.

This lesson ties together all the Bash scripts you wrote in Lessons 1–7 and organizes them into a professional repository that you could hand to a new team member or present to an employer on day one.

Setting Up Your Repository

Begin on your Linux VM. Navigate to the directory that holds your course scripts and run:

```bash

git init dba-automation

cd dba-automation

```

Copy all five core scripts into this directory. Then stage and commit them together:

```bash

git add .

git commit -m "chore: initial commit of all course DBA scripts"

```

Next, create a remote repository on GitHub or GitLab (a free personal account is sufficient). Link it and push:

```bash

git remote add origin https://github.com/yourname/dba-automation.git

git push -u origin main

```

Never commit credentials—database passwords, connection strings, or API keys—to any Git repository. Use environment variables or a secrets manager instead. Accidentally pushing a password to a public repo is a security incident, not just a mistake.

Writing a Professional README

Your README.md is the front door of the repository. Every script must have its own section containing:

A missing or vague README forces teammates to read every line of code before they can safely use or modify a script. Treat the README as documentation that must be updated whenever the script changes.

Branching and the Hotfix Workflow

Direct commits to `main` are discouraged on professional teams because they bypass review. Instead, create a feature or hotfix branch, make your changes, and open a pull request (PR) for a teammate to approve before merging.

For this lesson you will practice the hotfix workflow:

```bash

git checkout -b hotfix/backup-retention

```

Open your backup script and change `RETENTION_DAYS` from its current default to 30. Stage and commit using the Conventional Commits format:

```bash

git add backup.sh

git commit -m "fix(backup): increase default retention to 30 days"

```

Push the branch and open a pull request on GitHub or GitLab. Write a PR description that explains why the retention period is changing—not just what changed. A reviewer reading only the description should understand the business reason.

After the instructor or a classmate approves, merge and delete the branch:

```bash

git checkout main

git merge --no-ff hotfix/backup-retention

git push origin main

git branch -d hotfix/backup-retention

```

The `--no-ff` flag preserves the branch history in the graph so the merge is visible.

Conventional Commits Format

Conventional Commits (conventionalcommits.org) is a lightweight specification for commit messages that makes automated changelogs and semantic versioning possible. The structure is:

```

<type>(<scope>): <short description>

```

Common types: `feat` (new feature), `fix` (bug fix), `chore` (maintenance, no behavior change), `docs` (documentation only), `refactor` (code restructure without behavior change). The scope in parentheses is optional but recommended for DBA repos—use the script name or subsystem (`backup`, `monitor`, `index`).

Writing a CHANGELOG

A CHANGELOG.md records what changed, when, and in which version or date. Use reverse-chronological order (newest entry at the top). Each entry should include a date, a brief description, and which script was affected. Even a simple, human-readable CHANGELOG signals professional discipline and is required by many enterprise change-management processes.

The Hand-Off Meeting

Technical skill alone does not make a DBA effective on a team. In the five-minute hand-off role-play, you will walk a classmate through the repo as if they are joining the team tonight for an on-call shift. Show them: where each script lives, how to read the README, how to check recent commits with `git log --oneline`, and how to open a PR if they need to make an emergency change. Clear verbal communication under time pressure is a real job skill.

Safety and Access Control

Git repositories that contain database scripts often become targets for credential harvesting. Apply the principle of least privilege to your remote repo: keep it private until your instructor explicitly requires a public link, revoke access for anyone who leaves the project, and add a `.gitignore` that excludes any files that might accidentally capture passwords, such as `.env` files or `*.log` files containing query output. These habits protect both your employer and any database users whose data the scripts touch.

Key terms8

Git repositoryA directory tracked by Git that stores the complete history of every file change, including who made each change and when.
Conventional CommitsA specification for writing structured commit messages using a type, optional scope, and short description (e.g., 'fix(backup): increase default retention to 30 days') to make history readable and support automated tooling.
Feature branchA Git branch created for a specific change or fix, kept separate from main until reviewed and approved, then merged back.
Pull request (PR)A request opened on a hosting platform such as GitHub or GitLab to merge one branch into another, providing a structured place for code review and written discussion before changes reach main.
CHANGELOGA human-readable file, typically CHANGELOG.md, that records a dated, reverse-chronological summary of notable changes made to scripts or software.
READMEA Markdown file at the root of a repository that describes the project's purpose, contents, usage instructions, dependencies, and any scheduled execution details.
.gitignoreA configuration file that tells Git which files or patterns to exclude from tracking, commonly used to prevent credentials, log files, and temporary files from being committed.
Merge (--no-ff)A Git merge strategy that always creates a merge commit even when a fast-forward is possible, preserving visible evidence of the branch in the project history.
In class: Students initialize a local Git repo, add all scripts written in Lessons 1–7, write a README.md that describes each script's purpose, usage, dependencies, and cron schedule, and push to a GitHub or GitLab account; the instructor reviews the repository link for completeness. · Students create a feature branch named hotfix/backup-retention, modify the RETENTION_DAYS default value, commit with a message following the Conventional Commits format (e.g., 'fix(backup): increase default retention to 30 days'), and merge back to main via a pull request with a written description. · Students write a CHANGELOG.md with entries for each script update made during the course, then role-play a five-minute hand-off meeting where they walk a 'new team member' (a classmate) through the repo structure, demonstrating the career-readiness communication skills from Course 1.
Materials: Linux VM, Git, GitHub or GitLab account, VS Code with GitLens extension, Conventional Commits specification (conventionalcommits.org), README template
Check: Repository must contain all five core scripts, a README with all required sections, at least one merged feature branch, and a CHANGELOG with at least three dated entries; instructor clones the repo and verifies all files run without modification to pass.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

Security and access control / data governance
1. A DBA accidentally commits a database password to a public GitHub repository. What is the correct immediate action?
Automation and scripting best practices
2. Which Conventional Commits message correctly describes a change that increases the default value of RETENTION_DAYS in a backup script?
Automation and scripting best practices
3. What is the purpose of the --no-ff flag when merging a feature branch into main?
Data management and documentation
4. A README section for a cron-scheduled backup script should include which of the following?
Security and access control / data governance
5. Which file should be added to .gitignore to prevent accidentally tracking files that may contain query output with sensitive data?
Data governance and team collaboration
6. In a professional DBA team workflow, what is the primary reason for opening a pull request rather than committing directly to main?
Data management and documentation
7. A CHANGELOG.md entry should be ordered in which way?
Automation and scripting best practices
8. Which Git command displays a compact, one-line-per-commit view of recent history that is useful for quickly orienting a new team member during a hand-off meeting?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.