Skip to content
BENIBIX Learn

Git Fetch

Development🔀 Version ControlRemotes

Also known as Fetch

Getting the new commits from the remote. Your own files stay just as they were.

Think of it like

Think of it like checking the post box. You see the new letters, but you have not opened them yet.

Example

Jack fetches before lunch. Git tells him main is one commit behind, so he reads Emma's change before he pulls it.

Why it matters

Fetching lets you look before you leap. You see what others did without risking your own work.

Definition

To fetch is to download new commits from a remote. Git stores them as a separate copy, like origin/main, beside your branch. You can then look at what changed before you mix it in. Nothing in your working files moves until you merge or rebase. A fetch is always safe to run.

Example code

console
$ git fetch
From https://example.com/ada/shop
   68ba79c..643e9b2  main       -> origin/main
$ git status
On branch main
Your branch is behind 'origin/main' by 1 commit, and can be fast-forwarded.
One new commit arrived, but Jack's own files have not changed.

Common mistake

Thinking a fetch updates your files. It only downloads; you still need to merge.

Key takeaways

  1. 1
    Download only. Your files stay as they are.
  2. 2
    Look first. See changes before mixing them in.
  3. 3
    Always safe. It cannot break your work.

Compare

Learn it properly