What is a Git repository?

Rob Percival
A free video tutorial from Rob Percival
Web Developer And Teacher
4.5 instructor rating • 41 courses • 1,806,599 students

Lecture description

A lecture video explaining what a Git repository is, and the different layers of functionality it provides.

Learn more from the full course

The Complete Python & PostgreSQL Developer Course

Build 9 projects—master two essential and modern technologies in Python and PostgreSQL

21:39:30 of on-demand video • Updated April 2020

  • Understand software and programming with Python from beginning to end
  • Create Python applications ranging from beginner, basic applications to advanced, useful and engaging applications
  • Learn how to extend Python applications by using a professional data storage which is PostgreSQL
  • Understand advanced concepts extremely useful in jobs and interviews, such as data structures and algorithms
English High and we'll come back in this video we're looking at what is a repository when we're using GET ALL OF OUR get related things are going to be in a repository the repository is the main get container in this are going to quickly try to explain what good it does for you and how the repository fits into that. Remember the get is a set of layers and this is really important to remember your repository is used to move files between those layers. Each layer has a function and when files are inside your repository you can move them from layer to layer using gets commands. Each layer provides some function such as aero control which is being able to go back on the changes that you've already made. Redundancy in case you lose your hard drive. You can have them on line and a few more things. Let's start by looking at these layers. And remember this video is not meant to give you full understanding of what it is but rather a quick overview of each of those layers and what they might be used for. The first layer is the file system. All of the files that you create in your computer are in your file system. And this is not a good layer. It's just your computer. So whenever you create a python file this is in your file system. It doesn't really give you anything except storage. If you lose your harddrive your files get lost. So this is the base layer and you create your repository in this layer when you want to create your repository what you do is you initialize and get in a folder and we're going to look at doing this in the next video. So you have your folders such as your Python project and you want to initialize get in that folder you install get in that folder essentially and that unlocks the ability to use the other layers in it. But remember when you initialize get in a folder you can only use the layers inside that folder and not outside of it but you can have many good repositories in your computer at the same time. Just remember to use a good repository for one project and a different repository for another project . Once you've installed get and you have your wife and files you can get to include them in the next snapshot . So that is the next layer is called the staging area. And when you tell get to include files in the next snapshot in the next commit what you're doing is you're adding files to the staging area so you have your pipe and project with your Python code and you can add your code into the staging area using a get command. And we're going to go into that. Once you've added your files to the staging area they are in the staging area but get hasn't really done anything with them yet. But you can create a snapshot of the files in the staging area and this snapshot is called the commit when you create a snapshot. You commit your staging area your staging area becomes empty. You don't lose the files naturally but the snapshot is created and is stored inside the folder. What happens once you've committed your files. Is that now the snapshot are puts in a history and you can go back to the previous snapshot. You can delete snapshots which deletes part of your files and you know you can undo some snapshots or or that sort of stuff. We're going to go into all the things you can do. Finally after you've created this snapshot when you've committed your files you can optionally push them to the cloud push them to a get service. So just get hub and another services bitbucket they also get lab. There's a bunch of them. Once you push them to the cloud which as I said is optional. This gives you some redundancy if your hard drive fails you will not lose your files because they are in get hub for example and then you can download them again when you push to the cloud. What you are pushing is your snapshot. So your history of the changes that you've made to over time are saved. So for example if you spend a month of working on a project making one snapshot per day and then you lose your hard drive but you pushed it to the cloud. Before that you can download the repository from get hub and that contains the snapshots that you did each day which is nice because that means you never really lose any work at all. So these are the different layers. And it's important to remember where your files are in each of these layers although there are commands to check that all of your files are always in your file system. They never leave your file system. Then you can initialize get with a special command that gives you get Powers's actually in a folder . And once you have that you can add files to the staging area. Then you can commit the files that are in your staging area. And finally you can push the commits to the cloud so to remember each layer has a function and it is optional to push your commits to a remote repository. Although that provides that redundancy that security that you're never going to lose your files. And remember also that layers are physical and they are all stored inside a hidden folder that gets created when you initialize get inside a folder. When you initialize your repository we're going to be looking at this in a few videos of the next section so that you can understand really what's happening behind the scenes and how you can interact with it in these levels. That's it for this video. And I see you in the next one.