Git Glossary
A quick reference to essential Git terms and concepts to help you navigate and work effectively with Git.
Key Terms
Branch
A parallel line of development in a repository, used to work on features or fixes separately from the main code.
Checkout
Switch to a different branch or restore files in your working directory.
Clone
Create a local copy of a remote repository.
Commit
A snapshot of your staged changes, saved to the repository history.
Conflict
Occurs when changes in different branches overlap and Git can’t automatically merge them.
Fetch
Download the latest changes from a remote repository without merging them.
Fork
Create a personal copy of someone else’s repository, often used to propose changes.
HEAD
A pointer to the current branch reference, usually the last commit you’re working on.
Index (Staging Area)
An intermediate area where you place changes before committing them.
Merge
Combine changes from one branch into another.
Git Terms Glossary
Branch
A separate line of development, used to work on new features without affecting the main code.
git branch feature/login
Checkout
Switch to another branch or a specific commit.
git checkout main
Clone
Create a local copy of a remote repository.
git clone https://github.com/user/repo.git
Commit
Record a snapshot of your staged changes.
git commit -m "Add login feature"
Conflict
Occurs when Git can’t automatically merge changes; you must fix the differences manually.
# Example merge conflict message
# CONFLICT (content): Merge conflict in file.txt
Fetch
Download updates from a remote repository without applying them to your current branch.
git fetch origin
Fork
Create your own copy of someone else’s repository (often done via GitHub’s interface).
Index (Staging Area)
Where changes go after you add them, but before you commit.
git add file.txt
Merge
Combine changes from one branch into another.
git merge feature/login
Origin
The default name for your main remote repository.
git remote add origin https://github.com/user/repo.git
Pull
Fetch changes from a remote and immediately merge them into your current branch.
git pull origin main
Push
Upload your commits to a remote repository.
git push origin main
Rebase
Reapply your commits on top of another base branch.
git rebase main
Remote
A version of your repository stored on a server (like GitHub).
git remote -v
Repository (Repo)
The complete history and content of your project.
git init
Stash
Temporarily set aside changes that you’re not ready to commit.
git stash
Tag
Label a specific commit, often to mark releases.
git tag v1.0
HEAD
HEAD is a pointer to the current commit that your working directory reflects.
Typically, it points to the latest commit on your checked-out branch.
Example:
git log --oneline
# The first entry listed is the commit HEAD currently points to
Upstream
An upstream branch is the remote branch your local branch is set to track.
This lets you easily pull and push changes to/from the correct branch on the remote repository.
Example:
git push -u origin main
# The -u flag sets origin/main as the upstream branch for your local main branch