| 21 | Retrieving Remote Changes, Part II |
Many people new to Git treat git fetch
and git pull as synonyms. Understanding
the differences between the two is important to understanding how
Git handles remote repositories. Remember, remotes are read-only
branches. You fetch changes from a remote repository into those
branches (which are stored locally), instead of committing directly
to them, and then merge those changes as necessary. You can use
git pull to combine fetching and merging
into one command.
git pull follows Git’s convention and
assumes that you want to pull from the
origin remote repository if you do not
specify a remote. You must specify a remote if you want to provide
a specific branch to pull from.
You can provide a full refspec—two ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access