Git Glossary
This glossary covers common Git terms and concepts. Use it as a handy reference while learning and working with Git.
Summary of Git Terms
- Branch
- Checkout
- Clone
- Commit
- Conflict
- Fetch
- Fork
- HEAD
- Index (Staging Area)
- Merge
- Origin
- Pull
- Push
- Rebase
- Remote
- Repository (Repo)
- Stash
- Tag
- Upstream
- Working Directory
Branch
A branch is a parallel version of your repository. Used to develop features independently.
Example
git branch feature/login
Checkout
Switch to a different branch or commit.
Example
git checkout main
Clone
Create a local copy of a remote repository.
Example
git clone https://github.com/user/repo.git
Commit
A snapshot of your changes in the repository.
Example
git commit -m "Add login feature"
Conflict
When Git can't automatically merge changes from different commits or branches. You must resolve the differences manually.
Example
# Example: Merge conflict message
# CONFLICT (content): Merge conflict in file.txt
Fetch
Download changes from a remote repository without merging.
Example
git fetch origin
Fork
A personal copy of someone else's repository, usually on a platform like GitHub.
Example
# Use the GitHub interface to fork a repo
Index (Staging Area)
The Index (also called the Staging Area) is where changes are prepared before committing.
Example
git add file.txt
Merge
Combine changes from different branches.
Example
git merge feature/login
Origin
The default name for your main remote repository. You can rename or have multiple remotes if needed.
Example
git remote add origin https://github.com/user/repo.git
Pull
Fetch and merge changes from a remote repository.
Example
git pull origin main
Push
Upload your commits to a remote repository.
Example
git push origin main
Rebase
Move or combine a sequence of commits to a new base commit.
Example
git rebase main
Remote
A version of your repository hosted on the internet or network.
Example
git remote -v
Repository (Repo)
The database where your project's history is stored.
Example
git init
Stash
Temporarily save changes that aren't ready to commit.
Example
git stash
Tag
Mark a specific commit as important, usually for releases.
Example
git tag v1.0
Note: Refer to this glossary whenever you encounter an unfamiliar Git term!
HEAD
HEAD is a reference to the current commit your working directory is based on. Usually points to the latest commit on your current branch.
Example
git log --oneline
# The top entry is HEAD
Upstream
An "upstream" branch is the default branch that your branch tracks and pulls from, usually on a remote repository.
Example
git push --set-upstream origin main