Understand key Git terms to improve collaboration and usage of Git.
A Git repository stores your project files and version history, either locally or remotely.
A commit is a snapshot of your project at a specific point, including changes and metadata.
Branches allow parallel work on different features without affecting the main codebase.
Merging integrates changes from one branch into another, creating a new commit with both changes.
Cloning copies a remote repository to your local machine for development.
git pull fetches changes from a remote repository and merges them into the current branch.
git push sends your local commits to a remote repository to share changes.
The staging area holds changes ready to be committed, allowing selective commits.
A fork is a personal copy of a repository, allowing changes without affecting the original.
A PR is a request to merge changes from one branch into another, commonly used for review before merging.
Rebase moves or combines a sequence of commits to a new base commit, keeping history linear.
HEAD represents the current branch or commit you're working on in the repository.
A remote is a version of your repository hosted on a server that you can push/pull changes from.
A conflict happens when Git can't automatically merge changes. You must resolve them manually.
git checkout switches between branches or restores files to a previous state.
// Initialize a new Git repository
git init
// Add files to staging area
git add .
// Commit staged changes
git commit -m "Initial commit"
The repository is created, files are tracked, and a commit is added to Git history.
Working Directory ➜ Staging Area ➜ Repository ➜ Remote
git fetch before merging or rebasing to review changes.main and resolve any conflicts.git fetch and git pull to sync your local repository with the remote.