hey everyone my name is ishaan and i
welcome you all to this session in this
session we will be talking about gitpull
in the previous video we discussed the
basics of git github and git push we
learned how git push is used to push the
content from the local repository to the
remote repository you can watch that
video by clicking on the top right
corner today we will learn how we can
build the content from our remote
repository to a local repository so
without any further ado let's get
started with what is git pull let's say
we have a project on a remote repository
github and now we want to bring that
project onto a local repository or to
our system so for that first we will
fetch that project to our origin master
what origin master does is it fetches
changes from the locally stored branch
and merge that to the local checked out
branch so in the next step the origin
master will merge that project with the
branch and it will eventually reach our
local repository both processes together
are known as the gitpull request now
let's see the process in detail as we
saw in the previous part git pull first
fetches and then merges the changes from
the remote repository to a local
repository so now we know gitpull is a
combination of two commands where in the
first command fetch is executed and then
in the second command merge is executed
this collectively completes the process
of get pull now let's have a look at
what these two commands do git fetch
command commits files from the remote
repository into a local repository while
the git merge command combines multiple
commits into a single comment it merges
the branch from the remote repository to
the local branch now when we know about
the basics of gitpull let's go on to see
the working of gitpull with the help of
a demo in the demo first we will pull
content from our remote repository to
our system then we will make changes in
that folder and push it back to a remote
repository so now we will begin with
opening it bash and creating a direct
train to it
the directory that i will create is i'll
create it with the name
git underscore
demo
after i've created the directory i'll
check its location
i'll go to the directory
we can see there's nothing inside git
demo as of now
then
i'll create the directory with the name
changes
then let's go and navigate this
directory as well
we can see there's a folder with the
name changes as of now this folder is
also empty
now let me create a repository for this
folder we can create a repository with
the help of git init command
as we can see now an empty git
repository has been initialized to our
changes folder
we can go back and check here in the
changes folder we can see a dot get
folder is there this folder is headed i
can see this folder since i've enabled
my settings to view the hidden files if
we get into the folder we see a bunch of
directories and configurations make sure
you don't make any changes to any of the
directory
now let's go back to our git bash now
let's pull the directory that we created
in the last demo of git push
for that we will go to github
in the github we will go to a directory
here we'll go to clone or download and
copy this url
and paste that url here
when we paste the url we can see the
contents being pulled back
here when the contents have been pulled
back let's go and check the contents
when we go back to that folder in the
changes folder we can see git demo alpha
and beta if we go on to check the
content in the beta we have beta alpha
gamma
in alpha we have alpha beta gamma delta
while in the git demo folder we have the
git ppt and the git pdf
so now we will make changes in these two
notepads
and after that we will push that same
notepads back into the same directory
now let's open the notepad first for
opening the notepad
i will put the location of those
notepads
the name of our notepad was alpha
so in alpha
i will delete alpha from here
i'll save it and close it then i'll open
the next notepad that is with the name
beta
here i'll delete beta from here
save it and close it
so now let's check the status
in the status we can see alpha.txt and
beta.txt are modified
so
we will use the git add command
now to commit the changes we will use
git commit hyphen m
changes made
we can see two files change two
insertions made and two deletions
now let's check the status of the file
again
now when we check the status we can see
there's nothing to commit at all and the
working tree is clean
now when the changes are made we will
push all these files back to our
repository so for that we will go back
to github
here in the github we will copy this url
come back here then we'll type git
remote
add origin
and paste that url
in the next step we will write git
remote
hyphen v
we can see the fetch and the push
command in order in the last step when
we have to push everything back we will
write git push hyphen u
origin master
now we can see the contents have been
pushed back to github so let's go back
to our github and check the contents
when we go back to github let's refresh
it and see the contents of the file
change we can see the changes made
changes made the commit name that we had
given so when we open alpha.txt we can
see there's no alpha we have deleted it
it's beta gamma delta and when we open
beta dot txt
we can see beta has been deleted only
alpha and gamma is there
and so with this we have come to the end
of this session i hope you guys found it
informative and helpful thanks for
watching and stay tuned for more from
simply learn
hi there if you like this video
subscribe to the simply learn youtube
channel and click here to watch similar
videos to nerd up and get certified
click here