AI Hints
Home›Git & GitHub Tutorial›Your First Repository
Git & GitHub · Lesson 6 of 144

The Hidden .git Folder

Where history lives.

⏱ 2 min read▶ Video at 5:39🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

Files whose names start with a dot are hidden on most computers. So a normal listing won't show the dot git folder. Let's find it.

The Hidden .git Folder
From the video: The Hidden .git Folder
  • Names that start with a dot
  • Are hidden by default
  • Let's find .git

Seeing hidden files

First, a normal list, with l s. Nothing at all, the folder looks empty. Now add dash a, which means show all, including hidden files. There's dot git. Let's look inside it. These files are Git's own machinery. You'll never need to edit them by hand.

git
ls
ls -a
.
..
.git
ls .git
HEAD
config
description
hooks
info
objects
refs

One golden rule

Here's the golden rule. Never edit or delete the dot git folder by hand. If you delete it, your whole history is gone, and your folder becomes a normal folder again. Your files stay, but every snapshot disappears.

Don't edit.git by hand
Don't deleteit holds your history
Delete .git= history gone
Your fileswould stay

Summary

The dot git folder holds your history. Leave it alone, and let Git manage it. Next, the command you'll use more than any other.

Key takeaways
  • ls -a shows hidden files
  • .git holds the history
  • Never touch it by hand
Next up: git status — what is going on?