Git Fetch and Git Pull

Sharing buttons:

hello coders this is Jared with

Renaissance coders and in this video I'm

going to cover the git pull command the

git fetch command and the similarities

and differences between the two commands

so this should be a relatively short

video here I'm just going to cover those

commands fairly quickly so that way we

have a reasonable understanding of the

commands so we're going to start with

the git fetch command because it's a

little easier to understand the

differences if we start with the git

fetch command so the first question that

we need to answer is what does the git

fetch command actually do well the get

fetch command simply updates or pulls

the updates from our remote tracking

branches and pools is not really a great

word they're basically what we're doing

is we are getting the updates that have

been pushed to our remote branches to

our local machine now we have not gone

over branches yet but that's coming up

soon now a quick description of what a

branches couldn't hurt here so basically

a branch is a variation of our

repositories main code so remote

tracking branches are branches that have

been set up to push and pull from the

remote repo so I'm actually in a

repository here git ignore now if I

write if I type in git branch here they

can we then we can see what branch I'm

currently on which is master so this

branch has been set up to push and pull

to the remote repository on github so if

I now do a git fetch it is going to pull

down the updates that have been pushed

now I did have some updates that had

been pushed recently so now I have been

able to get those so you can see that my

master is now in sync with the origin

master an Origin here is basically

standing for github where our remote

repository lives the git fetch command

is a fairly safe command because it does

not change our working copy of code

locally okay so that's going to do it

for the git fetch command now let's move

on to the git pool command again the

first question that we need to answer is

what exactly does the git pull command


well the git pull command basically runs

two commands in one initially a get pool

runs a git fetch and then a get merge so

this command is not quite as

quote/unquote safe as the git fetch

command because the git pool will

actually download the changes made to

your current branch updating the code

within your repository the merge command

is where the actual updates to files

come in it is important to know

that the merge does not merge a branch

like Devin to master so if you have

multiple branches it's not going to like

all of a sudden merge a whole bunch of

branches together but it rather merges

our local repo with the remote repo with

the remote changes taking precedence the

biggest risk that can occur when running

the git pull command is getting changes

in a remote file that we have been

working in which may cause conflicts to

arise in certain cases again conflicts

is something that we're going to cover

in a later tutorial but for now just

know that that is you can arise running

the git pull command is again really

easy all we have to do is put in get

pull and the command should run so let's

do that now get pull now when I ran that

you can see that it even though I ran a

git fetch earlier I still pulled the

stuff down so the get fetch is basically

just checking and making sure that

updates have occurred and the get pull

is actually merging that in with my

current branch and you can see the file

that was pulled in which is the readme

dot markdown and you can see that it was

a fast forward type of merge and you can

also see the commit sha and things like

that and finally it tells us what

happened which is create mode the file

security settings in the file that was

actually created so in conclusion we

have covered with the git pool and the

git fetch command and the biggest

difference between the two is that git

pool has emerged included in it whereas

the git fetch does not okay that's going

to conclude this tutorial hopefully you

learned something new about git fetch

and get pull as always thanks for

watching and don't forget to Like and