.git directory
The hidden directory at the root of a repository where Git keeps all of its data: objects, refs, HEAD, config and the index.
In more detail
Your editor ignores it and you rarely open it, but it is the repository: HEAD names the current branch, refs holds branches and tags, objects holds every commit, tree and file, and config holds local settings. It is never committed itself, which is why hooks inside it do not travel with a clone.
Examples
ls -als .gitRelated terms
- repository — A project folder whose full history is tracked by version control; in Git, your files plus the hidden .git directory that stores every commit.
- HEAD — Git's pointer to where you are: normally the name of the current branch, and through it the current commit.
- ref — A Git name that points at a commit, such as a branch (refs/heads/main) or a tag (refs/tags/v1.0).
- Git object — One item in Git's database, a blob, tree, commit or annotated tag, stored under the hash of its content.
- staging area — Git's list of exactly what the next commit will contain, kept in the file .git/index; also called the index.
- git config — The command that reads and writes Git settings, which live in plain text config files.
Taught in
- Installing Git, And Telling It Who You Are — Advanced Git Internals & Distributed Workflows
- A Repository Is A Folder With A Memory — Advanced Git Internals & Distributed Workflows
- The Three Areas: Working Tree, Index, Repository — Advanced Git Internals & Distributed Workflows
- Conventional Commits — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- A Branch Is A Moving Pointer — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- Interactive Rebase: Squash, Reorder, Reword — Advanced Git Internals & Distributed Workflows