Downloading from Mission Control
While you work, teammates push changes to GitHub. Use git pull to download and integrate their work into yours.
The Pull Command
git pull
By default, this downloads new commits and merges them into your current branch.
What Pull Actually Does
git pull is essentially two steps by default:
git fetch: Downloads new commitsgit merge: Merges them into your branch (unless you've configured pull to rebase)
You can run these separately for more control.
Fetch vs. Pull
Fetch (Safe)
git fetch
Downloads changes but doesn't merge. Lets you review before integrating.
Pull (Convenient)
git pull
Downloads and integrates changes in one step. Faster but less control.
Specifying Remote and Branch
git pull origin main
Pull with Rebase
git pull --rebase
Instead of merging, rebases your commits on top of the pulled changes, creating cleaner history.
Handling Conflicts
If you and a teammate edited the same lines, Git can't auto-merge:
Auto-merging navigation.js
CONFLICT (content): Merge conflict in navigation.js
Automatic merge failed; fix conflicts and then commit.
Open the conflicted file. You'll see:
<<<<<<< HEAD
const speed = 1500;
=======
const speed = 2000;
>>>>>>> main
Edit to resolve, remove markers, then:
git add navigation.js
git commit
Best Practices
- Pull before starting work each day
- Pull before pushing
- Commit your work before pulling
- Pull frequently to avoid conflicts
Workflow Tip
Many developers follow this pattern:
- Start the day:
git pull - Work on code
- Commit changes
- Before pushing:
git pull - Resolve any conflicts
git push
Viewing Remote Changes
After git fetch, compare with:
git log HEAD..origin/main # See new commits
git diff HEAD origin/main # See changes
Next: Scanning for Changes
You can now synchronize with teammates. Next, we'll learn to examine differences between versions with git diff.