What Is Git?
Git is a distributed version control system designed to track changes in source code and other files. Unlike a simple backup system, Git records a history of changes so developers can inspect, compare, revert, branch, merge, and collaborate safely.
Git is distributed, which means a cloned repository contains the complete repository history rather than depending on a single central server for normal version-control operations.
A typical workflow is: modify files → inspect changes → stage changes → create a commit → share commits with a remote repository.
Git is the version-control system. GitHub, GitLab, and Bitbucket are services that host Git repositories and provide collaboration features.
mkdir git-demo
cd git-demo
git init
echo "Hello Git" > README.md
git add README.md
git commit -m "Initial commit"git init creates a Git repository. git add places a change into the staging area, and git commit permanently records the staged snapshot in the repository history.- Git tracks changes as a history of commits.
- Git repositories contain their own local history.
- The normal workflow moves changes from working directory to staging area and then into a commit.
What is Git primarily used for?