Back to roadmap

Lesson 11

Pull

Pull fetches remote commits and then integrates them into your current branch.

Visual Explanation

Ready to run git pull --rebase origin main.

Keep These Ideas

Two actions
Pull is fetch followed by merge or rebase.
Current branch
The downloaded work is integrated into the branch you are on.
Review conflicts
Integration can pause when local and remote edits overlap.

The Real Command

Terminal
git pull --rebase origin main
Example Output
From https://gitlab.com/acme/shop
 * branch            main       -> FETCH_HEAD
Successfully rebased and updated refs/heads/main.

This fetches origin/main, then replays your unpublished local commits on top for a linear history.

Command Details

git pull --no-rebase origin main

--no-rebase explicitly chooses merge. It fetches origin/main, then merges it into your current branch.

Example Output
From https://gitlab.com/acme/shop
 * branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.
 app.js | 4 ++++
git pull --ff-only origin main

--ff-only refuses a divergent history. It updates only when Git can move the current branch forward without a merge commit.

Example Output
Updating a1b2c3d..d4e5f6a
Fast-forward

Knowledge Check

Download and Integrate Updates

Update a local branch while understanding the extra rebase step.

Question 1 of 5

  1. Question 1: current
  2. Question 2: not started
  3. Question 3: not started
  4. Question 4: not started
  5. Question 5: not started
Command Challenge

Download origin/main and replay your local commits on top of it instead of creating a merge commit.