Git lives on your machine. GitHub lives on the internet. Your test code needs to be on GitHub so your team can access it, CI/CD can run it, and you have a backup if your laptop dies tomorrow.
# Add GitHub as a remote (run this inside your local repo)
git remote add origin https://github.com/your-username/selenium-test-framework.git
# Verify the remote was added
git remote -v
# origin https://github.com/your-username/selenium-test-framework.git (fetch)
# origin https://github.com/your-username/selenium-test-framework.git (push)
# Push your local commits to GitHub (first time only, -u sets upstream)
git push -u origin main
# Your code is now on GitHub!| Command | What It Does | When to Use |
|---|---|---|
| git push origin <branch> | Uploads your commits to GitHub | After committing — share your work |
| git pull origin main | Downloads + merges latest changes | Start of every day — get team's updates |
| git clone <url> | Downloads an entire repo | First time on a new machine |
| git fetch origin | Downloads changes WITHOUT merging | When you want to look before merging |
# Push your feature branch
git push origin feature/login-tests
# Pull latest main (do this every morning)
git pull origin main
# Clone a repo (first time setup — new laptop, new job)
git clone https://github.com/company/selenium-test-framework.git
# Fetch without merging (just peek at what changed)
git fetch originOn your first day at a new company, they'll give you the repo URL. You'll run git clone, open the project in IntelliJ, and you're ready to write tests. That's the entire onboarding for test code.
Q: What is the difference between git pull and git fetch?
A: git fetch downloads changes from the remote but does NOT merge them into your local branch. It just updates your remote tracking references — you can review what changed before deciding to merge. git pull does a git fetch followed by a git merge — it downloads AND merges the changes into your current branch. I use git fetch when I want to see what my team pushed before merging, and git pull when I want to update my branch immediately.
Always pull before you push. If your teammate pushed changes and you try to push without pulling first, Git will reject your push. Run git pull origin main first, resolve any conflicts, then push.
Key Point: GitHub is where your team's test code lives. Push your work, pull your team's updates — do both every day.