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,
0:04 or one of your collaborators has pushed some changes to GitHub,
0:08 how do you get that code into your local repository?
0:11 That is where the opposite of the "git push" command comes in - "git pull".
0:14 "git pull" will take the commits and the code within those commits
0:18 from a remote repository and pull it down into your local repository,
0:23 you've already got the hang on the "git push" command
0:26 so we'll slide back over into terminal and you can take a look at how this one works.
0:29 We just made our change directly on GitHub,
0:31 now what this means is there a remote repository
0:33 that is stored on GitHub is one commit ahead of our local repository,
0:37 this situation can also come up when other people that you are working with
0:41 commit and then push up their code to the central repository that is stored on GitHub.
0:46 It needs some way to take those new commits
0:49 and bring them down to your local Git repository,
0:52 let's do this now with the "git pull" command,
0:54 I've switched over into my Full Stack Python local repository,
0:58 we can say if we type "get status", there is no in progress changes
1:02 that have not yet been committed,
1:04 however, if we use the "git log" command and we just say "give me the last commit",
1:08 we'll see "add markdown stub page", but that is not the latest
1:12 commit that was actually created on GitHub.
1:14 So now we can say "git pull" and then specify where we want to pull from,
1:18 so I want to pull from origin, but before we do that,
1:21 let's take a look with the git remote command
1:24 and we'll see that origin is set up for Matt Makai Git repository,
1:29 that is the right location and we can say "git pull origin"
1:32 and now it's going to pull down the changes from a certain branch,
1:36 so I made those changes in the GitHub pages branch,
1:39 and I'll press enter and now we get our changes that we made
1:42 directly through the GitHub web user interface
1:45 and we pulled down that latest commit.
1:48 So just as we used "git push" earlier when we made local changes,
1:51 we can use "git pull" to pull down changes from remote repositories.
1:55 And that is how you keep everything in sync.
1:57 We've covered a lot of ground in this chapter, but with all these commands,
2:00 you are in great shape to keep track of all the changes in your repository
2:04 and along with GitHub, work with other collaborators on your project.