Code Reference

Glossary

Git · Reference cheat sheet

Glossary

Git · Reference cheat sheet


📋 Overview

Alphabetical glossary of core Git terms for commits, branches, remotes, history rewriting, and collaboration workflows.

🔧 Core concepts

TermDefinition
AmendRewriting the latest commit by adding staged changes or editing its message.
BranchA movable pointer to a commit, usually representing a line of development.
Cherry-pickCopying a commit’s changes onto another branch as a new commit.
CloneCreating a local copy of a remote repository including history.
CommitA snapshot of the staged project state with metadata and a parent link.
ConflictOverlapping changes Git cannot auto-merge and must be resolved by hand.
Detached HEADA state where HEAD points at a commit, not a branch name.
DiffA patch showing line-level changes between two trees or commits.
Fast-forwardA merge that simply moves a branch pointer forward with no merge commit.
FetchDownloading remote commits and refs without updating local branches.
HEADThe symbolic ref pointing at the current branch or checked-out commit.
HookA script Git runs on events like pre-commit or pre-push.
IndexThe staging area holding the next commit’s proposed snapshot.
MergeCombining histories from two branches into one.
OriginThe conventional default name for a cloned remote.
PullFetching from a remote and integrating into the current branch.
PushUploading local commits to a remote branch.
RebaseReplaying commits onto another base to linearize history.
ReflogA local log of where HEAD and branch tips have pointed.
RemoteA named URL pointing at another repository copy.
ResetMoving a branch pointer (and optionally index/worktree) to another commit.
RevertCreating a new commit that undoes a previous commit’s changes.
StashTemporarily shelving uncommitted worktree changes.
TagA named marker for a specific commit, often used for releases.
WorktreeAn additional working directory attached to the same repository.

💡 Examples

Stage and commit:

git status
git add README.md
git commit -m "docs: clarify install steps"

Branch, merge, and push:

git switch -c feature/login
# ... edits ...
git switch main
git merge feature/login
git push origin main

Stash and rebase:

git stash push -m "wip"
git pull --rebase origin main
git stash pop

⚠️ Pitfalls

  • Confusing reset (moves branch/history locally) with revert (adds an undo commit).
  • Mixing fetch (download only) with pull (download + integrate).
  • Treating merge and rebase as identical — history shape and conflict timing differ.
  • Equating amend on a pushed commit with a safe local edit — rewriting published history needs force-push care.
  • Assuming stash is a backup — it is local and easy to drop accidentally.

On this page