TetSharing
Git & CLI tutorial · 12 chapters
  1. Terminal basics
  2. Working with files
  3. Pipes and redirection
  4. What Git is
  5. Staging and commits
  6. Viewing history
  7. Comparing changes
  8. Branches
  9. Merging
  10. Merge conflicts
  11. Undoing changes
  12. Remotes, push and pull

Final Git & CLI quiz
Cheat sheet: git commands
Cheat sheet: linux shell commands

Chapter 4 of 12 · By Ethan Cole · Updated November 21, 2026

What Is Git? Start a Repository With git init

Version control records the history of a set of files so you can see what changed, when and why, and go back to any earlier state. Instead of folders called final, final2 and final-really, you have one folder and a complete, searchable history.

Git is the version control system used by almost every software team today. It is distributed: every copy of a project contains its full history, so you can commit, browse history and create branches offline. Sites like GitHub and GitLab host shared copies, but Git itself is a program on your computer.

Repositories

A Git repository (repo) is a project folder that Git tracks. git init turns the current folder into one by creating a hidden .git directory. Everything Git knows (every saved version, every branch, your settings for this repo) lives inside .git. Delete it and the folder becomes an ordinary folder again, with your current files untouched but the history gone.

One-time setup

Before your first commit, tell Git who you are. These values are written into every commit you make:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Recent Git versions also let you choose the name of the first branch with git config --global init.defaultBranch main.

git status: your dashboard

git status tells you which branch you are on and how each file stands. Run it constantly; it is read-only and often suggests the next command. A brand new file shows up as untracked: Git sees it but is not recording it yet.

Terminal · bash + git · copy and run locally
mkdir recipes
cd recipes
git init -q
ls -a
git status
echo "Pancakes: flour, milk, eggs" > pancakes.txt
git status

Transcript (verified by our test suite in a fresh temp folder)

$ mkdir recipes
$ cd recipes
$ git init -q
$ ls -a
.
..
.git
$ git status
On branch main

No commits yet

nothing to commit (create/copy files and use "git add" to track)
$ echo "Pancakes: flour, milk, eggs" > pancakes.txt
$ git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	pancakes.txt

nothing added to commit but untracked files present (use "git add" to track)

The transcript creates a folder, runs git init, shows the hidden .git directory with ls -a, then creates a file and checks git status. Notice the hint Git prints about how to start tracking the file. The next chapter does exactly that.

Is Git the same as GitHub?

No. Git is the tool; GitHub is a website that hosts Git repositories and adds features like pull requests and issues. You can use Git for years without any hosting service, and you can move a repository between hosts because the full history travels with it.

Common mistakes

  • Running git init in your home directory by accident, which makes everything below it look like one giant project. If that happens, remove the stray .git folder there.
  • Skipping the name and email setup, which makes the first commit fail or record a guessed identity.

Summary

  • Version control keeps a full history; Git is the standard, distributed tool.
  • git init creates a repository by adding a .git directory.
  • git status shows the branch and the state of each file.

Quiz: What Git is

1. What does git init create?

The .git directory holds all of Git's data for the repository.

2. A new file appears in git status as untracked. What does that mean?

Untracked files exist in the folder but have not been added to Git.

3. Which statement is true?

Git is a local tool; hosting services are optional.

Official docs

Written under the pen name Ethan Cole with AI-assisted drafting. Every code example on this page is executed by our test suite before publishing. Found a mistake? Tell us.