Git Glossary
A comprehensive guide to Git terminology, covering both day-to-day usage and internal mechanics.
## A
### Amend
Amend (`git commit --amend`) allows you to change the commit message or add staged changes to the previous commit. It effectively replaces the old commit with a new one.
## B
### Bisect
Bisect (`git bisect`) allows you to mark a known "good" commit and a known "bad" commit, then Git automatically checks out a commit halfway between them to narrow down the issue.
### Blob
A "Binary Large OBject". In Git, a blob is the object type used to store the contents of a file. It contains the file data but no metadata (like the filename or permissions).
### Branch
A Branch represents an independent line of development. Internally, a branch is a reference (`ref`) pointing to the latest commit in a line of history.
## C
### Cherry-pick
Cherry-pick (`git cherry-pick `) allows you to take a specific commit from one branch and apply it onto another branch.
### Commit
A Commit is an object that represents a specific snapshot of the repository at a given time. It contains a pointer to the main tree object, a message, author information, and pointers to zero or more parent commits.
### Content-Addressable Storage
A storage mechanism where data is retrieved based on its content (specifically, a hash of its content) rather than its location. Git uses this model, where every object is stored by its SHA-1 hash in the Object Database.
## D
### DAG (Directed Acyclic Graph)
A DAG is a graph structure where edges have a direction and no loops exist. Git commits form a DAG where every commit points to its parent(s).
### Delta Compression
A method of storing data where only the differences (deltas) between versions are stored, rather than the full content of every version. Git uses this in packfiles to save disk space.
### Detached HEAD
Detached HEAD occurs when the `HEAD` pointer points directly to a commit hash rather than a branch reference. In this state, new commits are not associated with any branch and can be easily lost.
## F
### Fast-forward
A merge type where the current branch pointer is simply moved forward to the target commit, without creating a new merge commit. This is only possible if the target commit is a direct descendant of the current branch.
## G
### Git
A distributed version control system created by Linus Torvalds in 2005, designed to handle everything from small to very large projects with speed and efficiency.
## H
### HEAD
HEAD is a special reference (pointer) that indicates "where you are" in the repository history. It usually points to the current branch.
## I
### Index (Staging Area)
The Index (also known as the "Staging Area") is a binary file (typically `.git/index`) that stores the directory tree structure of the files to be included in the next commit.
## M
### Merge
Merge (`git merge`) combines the changes from one branch into another.
## O
### Object Database
The `.git/objects` directory, where Git stores all content (blobs, trees, commits, tags) addressed by their SHA-1 hashes.
### Origin
The default name for the remote repository that a project was cloned from.
## P
### Packfile
A file that bundles multiple Git objects together, compressed using delta compression to save disk space and improve network transfer efficiency.
### Plumbing
The low-level, core commands in Git (e.g., `git hash-object`, `git update-index`) that form the foundation for the user-friendly "porcelain" commands.
### Porcelain
The high-level, user-friendly commands in Git (e.g., `git add`, `git commit`, `git push`) that users interact with daily. They abstract away the complexity of plumbing commands.
### Pull Request (PR)
A feature in hosting services like GitHub/GitLab where a developer asks a maintainer to merge changes from their branch into the main codebase.
## R
### Rebase
Rebase (`git rebase`) moves or combines a sequence of commits to a new base commit. It rewrites history to create a linear progression.
### Ref (Reference)
A user-friendly name that points to a specific SHA-1 hash (usually a commit). Branches (`refs/heads/master`) and tags (`refs/tags/v1.0`) are examples of refs.
### Reflog
Reflog (Reference Log) records when the tip of branches and other references were updated in the local repository.
### Remote
A version of your repository that is hosted on the internet or another network.
### Reset
Reset (`git reset`) moves the HEAD pointer to a specific commit, optionally modifying the index and working directory.
### Revert
Revert (`git revert`) safely undoes changes by creating a new commit that is the inverse of the target commit, preserving history.
## S
### SHA-1
Secure Hash Algorithm 1. A cryptographic hash function that Git uses to generate a unique 40-character hexadecimal identifier for every object based on its content.
### Squash
Squash is often used during an interactive rebase to clean up history before merging.
### Stash
Stash (`git stash`) saves your local modifications away and reverts the working directory to match the HEAD commit.
## T
### Tag
A Tag is a reference pointing to a specific commit. A "lightweight" tag is just a pointer, while an "annotated" tag is a full object containing metadata.
### Tree
An object type that represents a directory. It maps file names to blob hashes and directory names to other tree hashes, building the directory structure of the project.
## U
### Upstream
The default remote branch that a local branch tracks.
## W
### Working Directory
The Working Directory is the directory on your file system where you edit files. It contains the checked-out version of the project.
</div>