Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Branches and Merging Remote Branches Remote Branches

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Difference between git fetch and git pull

I'll be honest, working as an individual I don't tend to use GitHub as a collaborator. I use it as a way of saving and backing up my projects. When I'm getting my projects up to date, I git clone URLS if I need to or I use git pull.

In this video we use git fetch. What's the difference between the 2 and if I used git fetch in the same way, would it work?

I think I've understood the process of using merge and fetch though and I'm keen to solidify these so I can learn to contribute and collaborate in the future.

1 Answer

Steven Parker
Steven Parker
229,644 Points

As I understand it, git fetch is a basic download while git pull also incorporates the download into code you may be working on. So git pull would essentially be a combination of git fetch followed by git merge.

I also found a short (under 4 minutes) YouTube Video on this topic that you might like.

Good seeing you online again. Happy coding!

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

So it sounds like using git pull is something you'd only use if you were absolutely sure you wanted to do in case it introduced something into your local repo that you didn't want in there. But git fetch wouldn't do that? In any case, I've never really had a problem using git pull but maybe that's just cos of the way I use git.

I haven't been away really. Not really, things just been a bit chaotic behind the scenes :)

Steven Parker
Steven Parker
229,644 Points

I can certainly relate to chaos. Plus we don't have the immediate connection channel we used to.