← Back to Chapters

Git Glossary

? Git Glossary

? Quick Overview

Understand key Git terms to improve collaboration and usage of Git.

? Key Concepts

  • Version control fundamentals
  • Collaboration using branches and remotes
  • Tracking and managing code history

? Syntax / Theory

? Repository

A Git repository stores your project files and version history, either locally or remotely.

? Commit

A commit is a snapshot of your project at a specific point, including changes and metadata.

? Branch

Branches allow parallel work on different features without affecting the main codebase.

? Merge

Merging integrates changes from one branch into another, creating a new commit with both changes.

? Clone

Cloning copies a remote repository to your local machine for development.

? Pull

git pull fetches changes from a remote repository and merges them into the current branch.

? Push

git push sends your local commits to a remote repository to share changes.

? Staging Area

The staging area holds changes ready to be committed, allowing selective commits.

? Fork

A fork is a personal copy of a repository, allowing changes without affecting the original.

? Pull Request (PR)

A PR is a request to merge changes from one branch into another, commonly used for review before merging.

? Rebase

Rebase moves or combines a sequence of commits to a new base commit, keeping history linear.

? HEAD

HEAD represents the current branch or commit you're working on in the repository.

? Remote

A remote is a version of your repository hosted on a server that you can push/pull changes from.

? Conflict

A conflict happens when Git can't automatically merge changes. You must resolve them manually.

? Checkout

git checkout switches between branches or restores files to a previous state.

? Code Examples

? View Code Example
// Initialize a new Git repository
git init

// Add files to staging area
git add .

// Commit staged changes
git commit -m "Initial commit"

? Live Output / Explanation

The repository is created, files are tracked, and a commit is added to Git history.

?️ Interactive Concept Flow

Working Directory ➜ Staging Area ➜ Repository ➜ Remote

? Use Cases

  • Team collaboration on shared codebases
  • Tracking changes and reverting safely
  • Managing multiple features in parallel

? Tips for Using Git Terms

  • Write concise and descriptive commit messages.
  • Regularly pull from the remote to stay synced.
  • Use git fetch before merging or rebasing to review changes.

? Try It Yourself

  • Create and commit changes in a new branch.
  • Merge a branch into main and resolve any conflicts.
  • Use git fetch and git pull to sync your local repository with the remote.