# Pro Git

## Metadata
- Author: [[Scott Chacon and Ben Straub]]
- Full Title: Pro Git
- Category: #git #programming-best-practices
## Highlights
- Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. ([Location 806](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=806))
- Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it. Every checkout is really a full backup of all the data. ([Location 835](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=835))
- Git thinks of its data more like a set of snapshots of a miniature filesystem. Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored. Git thinks about its data more like a stream of snapshots. ([Location 862](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=862))
- Most operations in Git only need local files and resources to operate—generally no information is needed from another computer on your network. ([Location 872](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=872))
- Everything in Git is check-summed before it is stored and is then referred to by that checksum. ([Location 884](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=884))
- Git has three main states that your files can reside in: committed, modified, and staged. Committed means that the data is safely stored in your local database. Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot. ([Location 896](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=896))
- The Git directory is where Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer. ([Location 902](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=902))
- The working directory is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify. ([Location 903](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=903))
- The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit. ([Location 905](https://readwise.io/to_kindle?action=open&asin=B01ISNIKES&location=905))