Skip to content

Tools3 min read

Basic Git Commands Every QA Engineer Should Know

A practical cheat-sheet of the essential Git commands for QA professionals — from cloning a repo to raising a pull request.

ShareXLinkedInWhatsApp
On this page

Git is not just for developers. QA engineers use it daily to manage test scripts, raise pull requests, and collaborate on automation frameworks. Here's your essential cheat sheet:

Repository Setup

Code
git init                  # Initialize a new local repo
git clone <url>           # Clone a remote repository
git remote -v             # View remote connections

Daily Workflow

Code
git status                # See changed files
git add <file>            # Stage a specific file
git add .                 # Stage all changes
git commit -m "message"   # Commit with a message
git pull                  # Fetch + merge from remote
git push                  # Push local commits to remote

Branching

Code
git branch                # List branches
git branch <name>         # Create a new branch
git checkout <name>       # Switch to a branch
git checkout -b <name>    # Create and switch in one step
git merge <branch>        # Merge branch into current

History & Inspection

Code
git log                   # View commit history
git log --oneline         # Compact one-line view
git diff                  # Show unstaged changes
git diff --staged         # Show staged changes

Undoing Changes

Code
git reset HEAD <file>     # Unstage a file
git checkout -- <file>   # Discard local changes
git revert <commit>       # Revert a commit safely

Collaboration Tips for QA

  • Always work on a feature branch — never commit directly to main
  • Pull before you push to avoid merge conflicts
  • Use meaningful commit messages: test: add login regression suite
  • Review diffs before committing to catch accidental test data exposure
ShareXLinkedInWhatsApp

Written by the AITestCraft team. Spotted a mistake? Tell us through the contact link in the footer.

Put it to work

Practise the questions, or try the testing tools in your browser. No card needed to start.