Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: Git remote
0:01 So far we've only been working with our local Git repository with these commands.
0:04 But Git is known as a distributed version control system
0:07 the word distributed is important, because with each Git repository
0:11 we get not only the current version of the Git repository,
0:14 we get ever single change that has ever been made in that repository,
0:18 the setup is different than earlier version control systems
0:21 where you had to check files in and out of the central repository,
0:25 now with Git, we can share and sync up remote Git repositories with each other.
0:30 That is where the "git remote" command comes in.
0:32 The "git remote" command allows us to control and specify the remote repositories
0:38 that we want our local Git repository to work with.
0:44 We added the resources.markdown file to the staging area
0:47 and then committed it to our local Git repository.
0:50 Next, we'll use the "git remote" command to specify which repositories
0:54 not hosted on our local system we want to sync up with,
0:57 whether that is pulling down files from them or pushing changes to them.
1:01 Remember, we cloned this repository from GitHub using the "git clone" command,
1:05 so there is already a Git remote repository associated with this repository,
1:11 if we type the "git remote" command we'll see that there is one
1:13 but that doesn't give us a lot of context for what origin is,
1:16 I always use the "git remote command" with the "-v" option, this is for verbose.
1:22 "-v" describes not only the name of the other repositories,
1:26 but also the URL where that repository lives,
1:29 what happens if we use the "git init" command,
1:32 to create a new Git repository and don't have any remote repositories,
1:35 we can clear our way, existing remote repositories, with the "git remote remove" command.
1:40 Now when we type in "get remote -v", we'll see that there is nothing there,
1:43 but we actually wanted origin as a remote repository,
1:46 so we can add it back in, "git remote add" and then the name of the other repository
1:52 and then the URL for that repository.
1:56 Now again, "git remote -v" and we'll see we have origin back as a remote repository.
2:02 And we can absolutely have more than one Git remote repository at a time
2:06 so we could say personal server and then add a URL
2:12 that is along with our personal server.
2:14 So for example I could have a git.matmakai.com
2:17 and we can say "course-demos" for that.
2:20 Then when we type "git remote -v", we'll see we both have origin
2:24 which is for GitHub and personal server, that's the "git remote" command,
2:28 used to specify other repositories that we want to sync our files
2:34 and our file history and the commit history,
2:36 which contains all of the changes to our files over time.
2:39 After setting remote Git repositories, we can then use other commands
2:43 such as "git pull" and "git push", to sync those changes.