Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: Git push
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Now that we have the "git remote" command in our tool belt, we can use the "git push" command to transfer our new commits to another repository,
0:08
let's push the change that we made in this chapter on the course demos repository up to GitHub. We got our change committed,
0:17
and we can see that we have remote repository, with the name of origin, let's push our new commit up so this repository is synced
0:24
with what we have on GitHub, you can use the "git push" command so "git push" and then we're going to specify the name of that remote repository,
0:31
and there is one more thing, we need to specify the branch, and we've been working in the master branch so far,
0:37
before I kick this off, I want to just escape out of that command, not push up yet, and show "git branch", we're working on master.
0:45
"git branch" shows up which branch we're currently in, but how do we get into master? Well, the first time you run "git init",
0:53
it's going to create the master branch for you, that is where all of your changes are being made,
0:57
unless you explicitly specify that you want to work in a different branch, if you're making small changes to your project,
1:04
then you may never need to use other branches, you can just stick to master. Let's get back to pushing up our code.
1:10
Again, "git push origin master", now, GitHub is going to challenge us for our username and password, in my case it's mattmakai,
1:17
I'll paste in my password, and now we can see we pushed up to GitHub. We push from our master branch, into the master branch of the private repository.
1:29
Now when Michael is working on this project, he can pull down these changes and he can see the new file that we added,
1:35
"git push" is only one way that we can push our changes up, we can also use a pull request via GitHub which can often be much easier
1:43
for code review purposes and when you're working with the bunch of other people, "git push" is great when you're working on a repository by yourself,
1:50
or with just one other person, pull request tend to scale to a much larger teams, and we'll take a look at those a little bit later in the course.
1:57
For now, you should be able to use the "git remote" and "git push" commands in order to sync your changes up from your local repository into GitHub.
2:06
That provides you one way you can work with other people, and it also backs up your repository just in case anything happens
2:12
to your local system, and you need to pull down everything from GitHub.