Introduction to Git

When a project changes, version control lets you see what changed, who recorded it, and when. Git is a version control tool that can keep that history on your own computer.

On this page

Install Git and check the version

Use the official Git installation guide linked below for Windows, macOS, or Linux. On Windows, Git Bash is a convenient way to follow these examples. Reopen your terminal after installation and check the version.

git --version

Set the name and email for commits

Git records this identity in new commits. Replace the examples with your details. If you plan to publish the repository on GitHub and want to keep your email private, use the noreply address from your GitHub email settings.

git config --global user.name "Alex Rivera"
git config --global user.email "alex@example.com"
git config --get user.name
git config --get user.email

Create a local repository

A repository stores the project history. Create a separate practice folder, initialize it with a branch named main, and check the current state. Keep this project for the following lessons.

mkdir project-notes
cd project-notes
git init -b main
git status

Official references