Git for QA Engineers: The Complete Cheat Sheet Every SDET Actually Needs
Early in my career, I force-pushed to main. I did not fully understand what I was doing. I just knew the error messages were gone.
This cheat sheet covers every Git command you actually use as an SDET — from daily basics to recovering from disasters. No fluff. Commands you will use every week.
Contents
Daily Commands
# Check status before anything
git status
# Create feature branch for your test suite
git checkout -b test/login-automation
# Stage specific test files (not git add .)
git add tests/login.spec.ts
git add pages/LoginPage.ts
# Commit with clear QA-focused message
git commit -m "feat(tests): add login flow automation with POM"
# Push and set upstream
git push -u origin test/login-automation
Branching Strategy for QA Teams
# Naming convention
test/feature-name # New test suites
fix/flaky-test-name # Fixing flaky tests
refactor/page-objects # Refactoring test code
config/ci-pipeline # CI/CD changes
Stashing (Save Work Without Committing)
# Save current work
git stash push -m "WIP: checkout test halfway done"
# List stashes
git stash list
# Apply and remove
git stash pop
Recovering from Disasters
# Undo last commit but keep changes
git reset --soft HEAD~1
# Accidentally committed to main?
git reset --soft HEAD~1
git stash
git checkout -b test/my-feature
git stash pop
# Find lost commits
git reflog
QA-Specific .gitignore
# Test artifacts
test-results/
playwright-report/
screenshots/
videos/
allure-results/
# Environment
.env
.env.local
# IDE
.vscode/
.idea/
