Skip to content

Blog · 3 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.

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

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

Daily Workflow

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

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

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

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

Related