Git for Testers: 15 Essential Commands + GitHub Workflow
A practical Git and GitHub guide for QA engineers — 15 essential commands, a daily branching and pull request workflow, .gitignore for test projects and running tests in GitHub Actions.
The moment you move into test automation, your test scripts become code — and code lives in Git. Interviewers for automation roles regularly ask “How do you push your framework changes?” or “What do you do when you get a merge conflict?”. This guide to Git for testers covers exactly what a QA engineer needs: the core ideas, the 15 commands you will use every week and a realistic GitHub workflow.
You do not need to become a version-control expert. You need to be comfortable cloning a repository, creating a branch, committing clean changes, raising a pull request and recovering when something goes wrong. Let’s get there step by step.
Key takeaways
- Git is the version-control tool; GitHub (or GitLab, Bitbucket, Azure Repos) hosts repositories online.
- Never commit directly to main — work on a feature branch and raise a pull request.
- Keep reports, drivers, node_modules and secrets out of the repo with .gitignore.
- Pull often to avoid big merge conflicts.
Why Git for testers matters in 2026
Modern QA teams keep Selenium, Playwright, Cypress and API test suites in the same repository as the application, or in a dedicated automation repo. Tests run automatically in CI pipelines whenever code is pushed. If you cannot use Git, you cannot contribute to the framework, review a teammate’s tests or debug why a pipeline failed. Even manual testers benefit: checking which commit introduced a bug, or reading a pull request to understand what changed, makes your testing sharper.
Core concepts in plain words
- Repository (repo): a project folder whose full history Git tracks.
- Commit: a saved snapshot of changes with a message, author and unique ID (hash).
- Branch: an independent line of work. main holds stable code; you create branches for new tests or fixes.
- Staging area: where you choose which changes go into the next commit.
- Remote: the online copy of the repo, usually called origin.
- Pull request (PR): a request on GitHub to merge your branch into main after review. GitLab calls it a merge request.
One-time setup
Install Git from the official site, then set your identity so commits are attributed correctly:
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global init.defaultBranch mainFor GitHub, sign in over HTTPS with a personal access token or set up an SSH key — GitHub no longer accepts account passwords for Git operations.
15 essential Git commands for QA engineers
| Command | What it does |
|---|---|
| git clone <url> | Copy a remote repository to your machine |
| git status | Show changed, staged and untracked files |
| git switch -c <branch> | Create and move to a new branch |
| git switch <branch> | Move to an existing branch |
| git add <file> / git add . | Stage specific files or all changes |
| git commit -m “message” | Save staged changes as a commit |
| git push -u origin <branch> | Upload your branch and set its upstream |
| git pull | Fetch and merge the latest changes |
| git fetch | Download changes without merging |
| git log –oneline | Compact commit history |
| git diff | Show unstaged changes line by line |
| git restore <file> | Discard local changes in a file |
| git stash / git stash pop | Park unfinished work and bring it back |
| git merge <branch> | Merge another branch into the current one |
| git revert <hash> | Undo a commit safely with a new commit |
Older tutorials use git checkout -b to create branches; it still works, but git switch and git restore are clearer and recommended in current Git versions.
A daily GitHub workflow for automation testers
Here is the flow most teams follow when you add a new automated test, for example a login test in your Selenium or Playwright framework:
# 1. Start from the latest main
git switch main
git pull
# 2. Create a branch named after the ticket
git switch -c test/QA-142-login-negative-cases
# 3. Write or update tests, run them locally, then check changes
git status
git diff
# 4. Stage and commit with a clear message
git add tests/login.spec.ts
git commit -m "QA-142: add negative login tests for locked and invalid users"
# 5. Push the branch and open a pull request on GitHub
git push -u origin test/QA-142-login-negative-casesOn GitHub, open the pull request, describe what the tests cover, link the ticket and request a reviewer. After approval and a green CI run, the branch is merged into main and can be deleted.
Writing good commit messages
Keep the first line short (around 50–72 characters), start with the ticket ID and describe the change: “QA-142: add negative login tests”. Avoid messages such as “changes” or “fixed” — reviewers and your future self will thank you.
Reviewing pull requests as a tester
Reviews are not only for developers. When a teammate raises a PR with new tests, check that test names describe behaviour, assertions actually verify something meaningful, waits are explicit rather than fixed sleeps, and test data does not depend on another test. Leave specific, polite comments on the exact line. Reviewing others’ code is also one of the fastest ways to improve your own automation skills.
Handling merge conflicts
A conflict happens when you and a teammate edit the same lines — common in shared page objects or config files. Git marks the conflicting area in the file:
<<<<<<< HEAD
const BASE_URL = "https://qa.example.com";
=======
const BASE_URL = "https://staging.example.com";
>>>>>>> mainEdit the file to keep the correct version, remove the markers, then run git add on the file and git commit (or continue the merge). Talk to the teammate if you are unsure which change is right. Pulling main into your branch frequently keeps conflicts small.
Git tricks that help you find bugs
Git is also a debugging tool. git log -p <file> shows every change made to a file over time, and git blame <file> shows who last changed each line and in which commit — useful for finding the story or PR behind a behaviour change. When you know a feature worked in an older release but fails now, git bisect performs a binary search through commits to find the exact one that introduced the regression:
git bisect start
git bisect bad # current commit has the bug
git bisect good v2.3.0 # this tag was working
# Git checks out a middle commit; test it, then mark it:
git bisect good # or: git bisect bad
# repeat until Git prints the first bad commit
git bisect resetAdding “first bad commit: abc1234” to your bug report saves developers a lot of investigation time.
A .gitignore for test automation projects
# Java / Maven
target/
*.class
# Node (Playwright / Cypress)
node_modules/
test-results/
playwright-report/
cypress/videos/
cypress/screenshots/
# Reports and logs
allure-results/
allure-report/
*.log
# Secrets and IDE files
.env
.idea/
.vscode/Never commit passwords, API keys or tokens. Use environment variables or your CI tool’s secret store instead.
Running tests on every push with GitHub Actions
A simple workflow file at .github/workflows/tests.yml runs a Playwright suite whenever code is pushed or a pull request is opened:
name: UI Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx playwright install --with-deps
- run: npx playwright testBeing able to read and tweak a pipeline like this is a strong plus in interviews. If you are just starting with automation, read our manual to automation testing roadmap and the Selenium WebDriver tutorial, then version-control your practice framework from day one. The free Pro Git book is the best official reference when you want to go deeper.
🚀 Git on your resume? Start applying.
QA Jobs India shares 100+ fresh QA & software testing openings every morning — manual, automation, API and remote roles.
See today’s QA jobs →FAQs
Is Git for testers really necessary for manual QA roles?
It is not always mandatory, but basic Git helps you read pull requests and track changes, and it is essential once you move to automation.
What is the difference between Git and GitHub?
Git is the version-control software on your machine; GitHub is a hosting platform for Git repositories with pull requests, reviews and Actions.
What is the difference between git fetch and git pull?
git fetch downloads new commits without changing your files; git pull fetches and then merges (or rebases) them into your current branch.
How do I undo my last commit?
If it is not pushed, git reset –soft HEAD~1 keeps the changes staged. If it is already pushed, use git revert to undo it safely.
How long does it take to learn Git basics?
About a week of daily practice is enough for the commands and workflow in this guide.
Conclusion
Git for testers is less about memorising every command and more about a reliable routine: pull, branch, commit, push, pull request, review. Practise it on your own automation project, put the repository link on your resume, and you will handle Git questions in any automation interview. Then head to today’s QA jobs and start applying.
- 100+ fresh QA jobs daily + Direct HR email IDsLive every morning at 9 AM — apply straight to HR
- Weekly Mega Job Fair800+ QA jobs from India & around the world, every week
- Certified QA coursesUp to 17 courses, with certificate
- AI ATS Resume BuilderFree resume points included
- Full LinkedQA feedEvery post, fully unblurred
- Complete QA Material libraryInterview Q&A, cheat sheets, templates & roadmaps
Instant activation right after payment · One login for jobs, courses, resume & LinkedQA
💎 Get every QA opening, every day
Join QA Jobs India Premium for 100+ verified QA jobs daily with HR contact details.