Git Summary for QA/Test Automation Engineers
1. Repository Setup:
git init – Initialize a new repository
git clone repo-url – Clone a remote repository
2. Configuration:
Set username/email using
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. Staging & Committing:
git status – Check file changes
git add . – Stage all changes
git commit -m "message" – Commit changes
4. Branching:
git branch – List branches
git branch name– Create a branch
git checkout branch– Switch to a branch
git checkout -b name– Create + switch
5. Syncing with Remote:
git pull – Pull latest changes
git push – Push current branch
git push -u origin branch– Push new branch
6. Logs & Differences:
git log – Show commit history
git diff – Show unstaged changes
7. Undo Changes:
git checkout -- file – Discard local file changes
git reset file – Unstage a file
git reset --hard – Reset everything
8. Merge & Rebase:
git merge branch– Merge into current branch
git rebase branch– Reapply commits on top of another
9. Tags:
git tag– Add a version tag
git push origin tag– Push the tag
10. QA Tips:
Use branches for test cases per feature
Stash local changes with git stash