21. Fetch downloads. Pull also merges
Fetch downloads missing objects and moves the bookmarks only; pull is fetch followed by a merge or rebase of the bookmark into your branch.

21. Fetch downloads. Pull also merges

Fetch downloads missing objects and moves the bookmarks only; pull is fetch followed by a merge or rebase of the bookmark into your branch.

Fetch is always safe and pull is not, and the difference is one step.

git fetch talks to the remote. It downloads every commit you do not have yet.

Then it moves the bookmarks. Origin slash main now matches their main.

Your own branches do not move. Your files do not change. Fetch is safe to run any time.

git pull is fetch, then merge origin slash main into your branch. Or rebase onto it, if you set that.

So pull changes your branch and your files. Fetch only changes what you know.

Check yourself. After git fetch, has your branch moved?

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0

Connections show where other documents or comments link to this document.

Related documents

Loading connections…