Git & GitHub · Lesson 61 of 144
Pulling Changes
Git pull.
Fetch downloads. But you usually want the new commits in your own branch, and in your files. That's git pull. Pull is simply a fetch, followed by a merge.

- Fetch downloads only
- Pull brings changes in
- Pull = fetch + merge
git pull
Alex pushed a commit again. This time we run git pull. Git fetches it, then fast forwards our main. The last line of the home page now has Alex's change, and status says we're up to date with origin main.
git
git pull From https://github.com/sam/my-site f63a17a..7893b97 main -> origin/main Updating f63a17a..7893b97 Fast-forward index.html | 1 + 1 file changed, 1 insertion(+) tail -1 index.html <p>Now with a blog!</p> git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
A good habit
Here's a habit that saves a lot of trouble. Pull before you start working, and pull before you push. Then you're always building on the latest version, and conflicts stay small.
Start of the daygit pull
Before pushinggit pull
Always buildon the latest
Resultsmall conflicts
Summary
Git pull is fetch plus merge. Pull before you start, and before you push. Next, what happens when you forget.
Key takeaways- git pull
- = fetch + merge
- Pull before you push
Next up: When a Push Is Rejected — fetch first