Skip to content

Commit 2aada1f

Browse files
committed
Compare fetch and pull
1 parent fb4ed0f commit 2aada1f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

docs/basics.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ How is `fetch` different from `pull`? Pulling updates the HEAD of your repositor
176176

177177
> **What does HEAD mean?** `HEAD` is the name for the current version of the repository, the most recent commit. Notice in the section below, the top-most (i.e. most recent) commit will also be aliased as `HEAD`.
178178
179+
180+
{: .note }
181+
**How are `pull` and `fetch` different or similar?**
182+
183+
**`git fetch`** downloads changes from the remote and stores them in your remote-tracking branches (like `origin/main`), but leaves your working branch and local files completely untouched. You're essentially saying "show me what's out there" — you can then inspect the changes before deciding what to do with them.
184+
185+
**`git pull`** does a fetch and then immediately merges (or rebases, if configured) the fetched changes into your current branch. It's the two-step process collapsed into one command — convenient, but it can introduce merge commits or conflicts without you explicitly deciding to merge.
186+
187+
179188
## Log
180189

181190
Since `git` was built to track changes, returning a log of all commits is simple. The default output is verbose and each entry takes several lines:
@@ -263,4 +272,4 @@ Practice the above skills by doing the following:
263272
6. `git commit` the added/changed files and `git push` it to GitHub.
264273
7. Using the GitHub web interface, add another file to your repository.
265274
8. Use `git pull` to pull down changes in the repository.
266-
9. Use `git log` to view all commit activity in the repo.
275+
9. Use `git log` to view all commit activity in the repo.

0 commit comments

Comments
 (0)