Git

A distributed version control system that records project history and helps developers work in parallel.

2 min read 4 lesson sections
  • #git
  • #version control
  • #source code
  • #branches

A safety net for experiments

You are halfway through changing a feature when the old version suddenly worked better. Without a saved history, “undo” can become a stressful detective story. Git gives a project a timeline: you record meaningful snapshots, compare changes, and return to an earlier state when needed.

Commits are snapshots with a message

Git runs on your computer and stores project history in a repository. A commit records a selected set of changes; a branch gives you a separate line of work. You can experiment on a branch without disturbing the version your teammates are reviewing. Git does not require GitHub or an internet connection for local work.

git status
git add .
git commit -m "Add profile page"
git switch -c improve-profile

These commands show the working tree, stage changes, save a commit, and create a branch. Read git status often: it tells you what Git sees before you commit.

Collaboration without overwriting each other

When work is ready to share, Git can exchange commits with another repository. Teams commonly host a shared repository on GitHub or GitLab, then review proposed changes before merging them. Small, focused commits and clear messages turn the history into a useful story instead of a pile of mystery updates.

Mini mission

Create a tiny text file, commit it, edit one line, and inspect the difference with git diff. The point is not speed; it is feeling how safely you can try, compare, and change course.

Remember: Git is the version-control tool. GitHub is one service that hosts Git repositories and adds team features. They work together, but they are not the same thing.