Git Flashcards
Working directory / tree
The project directory associated with (containing) the local repository
Staging area / index
A file in your local repository containing the changes to the working directory that will go into the next commit
Local repository
A directory containing a snapshot and metadata for each of your commits; .git
Remote repository
A repository hosted on a network (internet)
Git init
Initializes an empty Git repository
Git add
Adds selected files to the staging area
Git status
Shows files that are:
- Untracked
- Modified but unstaged
- Staged but uncommited
Git commit
Creates a new commit (snapshot) with the files in the staging area
Git diff
Shows the differences between two objects (commits, files, trees, indices, etc)
Git log
Shows a list of all commits made to a repository
Git push
Updates the remote repository with the new commits from the local repository
Git fetch
Downloads the remote repository without updating the local repository; used to see what changes have been made since your last fetch or pull
Git merge
Joins two or more development histories (branches) together; used for merging new features into the main branch
Git pull
Fetches content from a remote repository and merges it with your local branch; a combination of fetch and merge
Git branch
Creates a new branch
Git checkout
Updates the working directory and HEAD to match the specified branch or commit
Git
A distributed version control system; used for tracking and managing changes to a code base
Three states of Git
- Modified
- Staged
- Committed
Git clone
Initializes a local repository with the contents of a specified remote repository and sets up remote tracking
HEAD
Refers to the currently active commit
Forking
Copying a remote repository without a connection to the original (like clone); used for changing code without affecting the original
Git remote
Manages the set of connected remote repositories