Great work!

XP to next level

BugEater
EN

Clean Repositories, Ignoring & Submodules

Advanced All professions 72 XP 66 min

Updated: 11/09/2026

Start Module

A repository fills up with build output, screenshots, node_modules and — eventually — someone's API key. This module is about what should never be committed, how to remove what already is, and what happens when your test suite lives in a repository of its own.

Why This Module Matters

Test automation projects are the worst offenders in any organisation. A single run leaves behind screenshots, videos, HTML reports, downloaded drivers and a .env file with staging credentials in it. Commit that once and it is in the history forever, in every clone, including the credentials.

.gitignore is the preventive half, and it deserves more care than it usually gets — particularly the rule that it only affects untracked files, which is why "I added it to .gitignore and it's still showing up" is the single most common Git complaint in QA teams.

git clean -fd is the corrective half: it deletes untracked files from your working directory. It is genuinely destructive — the deleted files were never committed, so no reflog and no recovery — which is why the module insists on -n first, every time.

Then there are submodules: a repository pinned inside another repository at an exact commit. QA meets them constantly, because shared test frameworks, fixture data and internal tools are so often kept separately.

What You'll Learn

  • Writing a .gitignore that covers a test-automation project, and the pattern syntax that actually matters
  • Why ignoring a tracked file does nothing, and the git rm --cached fix
  • .gitkeep: how to commit an empty directory Git refuses to track
  • git clean -n before git clean -fd, and what -x additionally destroys
  • What a submodule is: a pinned commit pointer, not a copy
  • Cloning with --recurse-submodules, updating one, and reading the "modified content" status that confuses everybody the first time

Pro Tip

Add .env, *.log, screenshots/, videos/ and allure-results/ to .gitignore on day one of any automation project. Removing a secret after it is committed means rewriting history in every clone — an operation you would much rather never need.

Module content