Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: Git pull
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
You've made some changes to your repository on GitHub through the web user interface, or one of your collaborators has pushed some changes to GitHub,
0:09
how do you get that code into your local repository? That is where the opposite of the "git push" command comes in - "git pull".
0:15
"git pull" will take the commits and the code within those commits from a remote repository and pull it down into your local repository,
0:24
you've already got the hang on the "git push" command so we'll slide back over into terminal and you can take a look at how this one works.
0:30
We just made our change directly on GitHub, now what this means is there a remote repository
0:34
that is stored on GitHub is one commit ahead of our local repository, this situation can also come up when other people that you are working with
0:42
commit and then push up their code to the central repository that is stored on GitHub. It needs some way to take those new commits
0:50
and bring them down to your local Git repository, let's do this now with the "git pull" command,
0:55
I've switched over into my Full Stack Python local repository, we can say if we type "get status", there is no in progress changes
1:03
that have not yet been committed, however, if we use the "git log" command and we just say "give me the last commit",
1:09
we'll see "add markdown stub page", but that is not the latest commit that was actually created on GitHub.
1:15
So now we can say "git pull" and then specify where we want to pull from, so I want to pull from origin, but before we do that,
1:22
let's take a look with the git remote command and we'll see that origin is set up for Matt Makai fullstackPython.com Git repository,
1:30
that is the right location and we can say "git pull origin" and now it's going to pull down the changes from a certain branch,
1:37
so I made those changes in the GitHub pages branch, and I'll press enter and now we get our changes that we made
1:43
directly through the GitHub web user interface and we pulled down that latest commit. So just as we used "git push" earlier when we made local changes,
1:52
we can use "git pull" to pull down changes from remote repositories. And that is how you keep everything in sync.
1:58
We've covered a lot of ground in this chapter, but with all these commands, you are in great shape to keep track of all the changes in your repository
2:05
and along with GitHub, work with other collaborators on your project.