Git Flashcards
What is the Git directory?
Where Git stores the metadata and object database for your project.
What is copied when you clone a repository from another computer
What is a working directory?
A single checkout (co) of one version of the project
Pulled from the Git directory to be used or modified
What is a staging area?
a file, generally contained on your Git directory, that stores information about what will go into your next commit
Also referred to as the index
Git Workflow
1- Modify files in your working directory
2- Stage the files - adding snapshots of them to your staging area
3- Do a commit which takes the files as they are in the staging area and stores the snapshot permanently to your Git directory
States:
1- committed - it is in the Git directory
2- modified - has been changed since it was checked out but has not been staged
3- staged - has been modified and added to the staging area
The 3 main sections of a Git project
1- The Git directory
2- The working directory
3- The staging area
How do you create a new git repository from an existing project?
Go to the project directory and type
git init
what does git init do?
creates a new subdirectory called .git
that contains a git repository skeleton
How do you get a copy of an existing git repository?
git clone [url]
what are the possible states that a file in your working directory can be in?
- tracked
- untracked
What are tracked files?
files that were in the last snapshot
What states can tracked files be in?
- unmodified
- modified
- staged
what are untracked files?
anything in your working directory that were not in your last snapshot and are not in your staging area
when you first clone a repository, in what state are all of the files?
tracked and unmodified
how do you determine which files are in which state?
git status