All commands

git pull

intermediate

Fetch the remote and fold it into your current branch.

What it does

git pull is two commands in one coat: a fetch (download remote objects + update remote-tracking refs) followed by a merge of those updates into your current branch. You can configure it to rebase instead of merge — either way your branch advances to include the remote work.

Your machine

local repository

main
objects downloaded, then merged ↓

Remote origin

everything.git

refs/heads/main← merges down

New objects travel down, then a merge integrates them into your branch

Watch it — press play

A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.

1 / 3

Step 1

Sync with the team

git pull fetches the remote's new work, then merges it into your current branch.

git pull

Your machine

local repository

main
objects downloaded, then merged ↓

Remote origin

everything.git

refs/heads/main← merges down

Objects come down…

Under the hood

1

Fetch + merge (default)

git pull = git fetch (get origin/main's new commits as refs/remotes/origin/main) then git merge origin/main on your side. The merge may be a fast-forward or create a merge commit — same logic as any merge.

2

Fast-forward is the typical happy path

If you've made no local commits, pulling is a pure pointer move: your branch slides to the remote's tip. No merge commit, linear history preserved.

3

--rebase is the linearity savior

git pull --rebase fetches, then replays your local commits on top of the remote's without creating a merge bubble. Configure pull.rebase true and your branch history stays a clean train.

4

Divergence means conflict work

If both you and the remote changed the same lines, the pull stops with conflicts. Resolve → git add → git commit (or git rebase --continue with --rebase).

Command anatomy

git pull [--rebase]
--rebase

Replay your commits on the remote's new base instead of merging.

--ff-only

Refuse a non-fast-forward merge — fail rather than diverge.

--tags

Also pull tags from the remote.

When to reach for it

Daily sync with the team: git pull before starting a workday block.

git pull --rebase main keeps your WIP branch linear against a fast-moving main.

git pull --ff-only when you want an explicit 'stay in sync, never diverge' discipline.

Practice

A real repo, pre-seeded with history, runs right here — stage, commit, branch, stash, diff, even hit and resolve a real merge conflict. Nothing to install, nothing leaves your machine.

Open practice playground

Go deeper with