[![Git](https://git-scm.com/images/logo@2x.png)](https://git-scm.com/) --distributed-is-the-new-centralized
![](https://git-scm.com/images/dark-mode.svg)
  * [About](https://git-scm.com/about)
    * [Trademark](https://git-scm.com/about/trademark)
  * [Learn](https://git-scm.com/learn)
    * [Book](https://git-scm.com/book)
    * [Cheat Sheet](https://git-scm.com/cheat-sheet)
    * [Videos](https://git-scm.com/videos)
    * [External Links](https://git-scm.com/doc/ext)
  * [Tools](https://git-scm.com/tools)
    * [Command Line](https://git-scm.com/tools/command-line)
    * [GUIs](https://git-scm.com/tools/guis)
    * [Hosting](https://git-scm.com/tools/hosting)
  * [Reference](https://git-scm.com/docs)
  * [Install](https://git-scm.com/install/linux)
  * [Community](https://git-scm.com/community)


  * Table of Contents
    * [NAME](https://git-scm.com/docs/gitrepository-layout#_name)
    * [SYNOPSIS](https://git-scm.com/docs/gitrepository-layout#_synopsis)
    * [DESCRIPTION](https://git-scm.com/docs/gitrepository-layout#_description)
    * [Git Repository Format Versions](https://git-scm.com/docs/gitrepository-layout#_git_repository_format_versions)
    * [SEE ALSO](https://git-scm.com/docs/gitrepository-layout#_see_also)
    * [GIT](https://git-scm.com/docs/gitrepository-layout#_git)


[ English ▾](https://git-scm.com/docs/gitrepository-layout)
Localized versions of **gitrepository-layout** manual
  1. [English ](https://git-scm.com/docs/gitrepository-layout)

Want to read in your language or fix typos?
[You can help translate this page](https://github.com/jnavila/git-manpages-l10n).
[Topics ▾](https://git-scm.com/docs/gitrepository-layout)
### Setup and Config
  * [ git ](https://git-scm.com/docs/git)
  * [ config ](https://git-scm.com/docs/git-config)
  * [ help ](https://git-scm.com/docs/git-help)
  * [ bugreport ](https://git-scm.com/docs/git-bugreport)
  * [ Credential helpers ](https://git-scm.com/doc/credential-helpers)


### Getting and Creating Projects
  * [ init ](https://git-scm.com/docs/git-init)
  * [ clone ](https://git-scm.com/docs/git-clone)


### Basic Snapshotting
  * [ add ](https://git-scm.com/docs/git-add)
  * [ status ](https://git-scm.com/docs/git-status)
  * [ diff ](https://git-scm.com/docs/git-diff)
  * [ commit ](https://git-scm.com/docs/git-commit)
  * [ notes ](https://git-scm.com/docs/git-notes)
  * [ restore ](https://git-scm.com/docs/git-restore)
  * [ reset ](https://git-scm.com/docs/git-reset)
  * [ rm ](https://git-scm.com/docs/git-rm)
  * [ mv ](https://git-scm.com/docs/git-mv)


### Branching and Merging
  * [ branch ](https://git-scm.com/docs/git-branch)
  * [ checkout ](https://git-scm.com/docs/git-checkout)
  * [ switch ](https://git-scm.com/docs/git-switch)
  * [ merge ](https://git-scm.com/docs/git-merge)
  * [ mergetool ](https://git-scm.com/docs/git-mergetool)
  * [ log ](https://git-scm.com/docs/git-log)
  * [ stash ](https://git-scm.com/docs/git-stash)
  * [ tag ](https://git-scm.com/docs/git-tag)
  * [ worktree ](https://git-scm.com/docs/git-worktree)


### Sharing and Updating Projects
  * [ fetch ](https://git-scm.com/docs/git-fetch)
  * [ pull ](https://git-scm.com/docs/git-pull)
  * [ push ](https://git-scm.com/docs/git-push)
  * [ remote ](https://git-scm.com/docs/git-remote)
  * [ submodule ](https://git-scm.com/docs/git-submodule)


### Inspection and Comparison
  * [ show ](https://git-scm.com/docs/git-show)
  * [ log ](https://git-scm.com/docs/git-log)
  * [ diff ](https://git-scm.com/docs/git-diff)
  * [ difftool ](https://git-scm.com/docs/git-difftool)
  * [ range-diff ](https://git-scm.com/docs/git-range-diff)
  * [ shortlog ](https://git-scm.com/docs/git-shortlog)
  * [ describe ](https://git-scm.com/docs/git-describe)


### Patching
  * [ apply ](https://git-scm.com/docs/git-apply)
  * [ cherry-pick ](https://git-scm.com/docs/git-cherry-pick)
  * [ diff ](https://git-scm.com/docs/git-diff)
  * [ rebase ](https://git-scm.com/docs/git-rebase)
  * [ revert ](https://git-scm.com/docs/git-revert)


### Debugging
  * [ bisect ](https://git-scm.com/docs/git-bisect)
  * [ blame ](https://git-scm.com/docs/git-blame)
  * [ grep ](https://git-scm.com/docs/git-grep)


### Email
  * [ am ](https://git-scm.com/docs/git-am)
  * [ apply ](https://git-scm.com/docs/git-apply)
  * [ imap-send ](https://git-scm.com/docs/git-imap-send)
  * [ format-patch ](https://git-scm.com/docs/git-format-patch)
  * [ send-email ](https://git-scm.com/docs/git-send-email)
  * [ request-pull ](https://git-scm.com/docs/git-request-pull)


### External Systems
  * [ svn ](https://git-scm.com/docs/git-svn)
  * [ fast-import ](https://git-scm.com/docs/git-fast-import)


### Server Admin
  * [ daemon ](https://git-scm.com/docs/git-daemon)
  * [ update-server-info ](https://git-scm.com/docs/git-update-server-info)


### Guides
  * [ gitattributes ](https://git-scm.com/docs/gitattributes)
  * [ Command-line interface conventions ](https://git-scm.com/docs/gitcli)
  * [ Everyday Git ](https://git-scm.com/docs/giteveryday)
  * [ Frequently Asked Questions (FAQ) ](https://git-scm.com/docs/gitfaq)
  * [ Glossary ](https://git-scm.com/docs/gitglossary)
  * [ Hooks ](https://git-scm.com/docs/githooks)
  * [ gitignore ](https://git-scm.com/docs/gitignore)
  * [ gitmodules ](https://git-scm.com/docs/gitmodules)
  * [ Revisions ](https://git-scm.com/docs/gitrevisions)
  * [ Submodules ](https://git-scm.com/docs/gitsubmodules)
  * [ Tutorial ](https://git-scm.com/docs/gittutorial)
  * [ Workflows ](https://git-scm.com/docs/gitworkflows)
  * [ All guides... ](https://git-scm.com/docs/git#_guides)


### Administration
  * [ clean ](https://git-scm.com/docs/git-clean)
  * [ gc ](https://git-scm.com/docs/git-gc)
  * [ fsck ](https://git-scm.com/docs/git-fsck)
  * [ reflog ](https://git-scm.com/docs/git-reflog)
  * [ filter-branch ](https://git-scm.com/docs/git-filter-branch)
  * [ instaweb ](https://git-scm.com/docs/git-instaweb)
  * [ archive ](https://git-scm.com/docs/git-archive)
  * [ bundle ](https://git-scm.com/docs/git-bundle)


### Plumbing Commands
  * [ cat-file ](https://git-scm.com/docs/git-cat-file)
  * [ check-ignore ](https://git-scm.com/docs/git-check-ignore)
  * [ checkout-index ](https://git-scm.com/docs/git-checkout-index)
  * [ commit-tree ](https://git-scm.com/docs/git-commit-tree)
  * [ count-objects ](https://git-scm.com/docs/git-count-objects)
  * [ diff-index ](https://git-scm.com/docs/git-diff-index)
  * [ for-each-ref ](https://git-scm.com/docs/git-for-each-ref)
  * [ hash-object ](https://git-scm.com/docs/git-hash-object)
  * [ ls-files ](https://git-scm.com/docs/git-ls-files)
  * [ ls-tree ](https://git-scm.com/docs/git-ls-tree)
  * [ merge-base ](https://git-scm.com/docs/git-merge-base)
  * [ read-tree ](https://git-scm.com/docs/git-read-tree)
  * [ rev-list ](https://git-scm.com/docs/git-rev-list)
  * [ rev-parse ](https://git-scm.com/docs/git-rev-parse)
  * [ show-ref ](https://git-scm.com/docs/git-show-ref)
  * [ symbolic-ref ](https://git-scm.com/docs/git-symbolic-ref)
  * [ update-index ](https://git-scm.com/docs/git-update-index)
  * [ update-ref ](https://git-scm.com/docs/git-update-ref)
  * [ verify-pack ](https://git-scm.com/docs/git-verify-pack)
  * [ write-tree ](https://git-scm.com/docs/git-write-tree)


[ Latest version ▾ ](https://git-scm.com/docs/gitrepository-layout) gitrepository-layout last updated in 2.49.0
Changes in the **gitrepository-layout** manual
  1. 2.49.1 → 2.53.0 no changes
  2. [2.49.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2025-03-14_ ](https://git-scm.com/docs/gitrepository-layout/2.49.0)
  3. 2.48.1 → 2.48.2 no changes
  4. [2.48.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2025-01-10_ ](https://git-scm.com/docs/gitrepository-layout/2.48.0)
  5. 2.45.1 → 2.47.3 no changes
  6. [2.45.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2024-04-29_ ](https://git-scm.com/docs/gitrepository-layout/2.45.0)
  7. 2.44.1 → 2.44.4 no changes
  8. [2.44.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2024-02-23_ ](https://git-scm.com/docs/gitrepository-layout/2.44.0)
  9. 2.43.2 → 2.43.7 no changes
  10. [2.43.1 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2024-02-09_ ](https://git-scm.com/docs/gitrepository-layout/2.43.1)
  11. [2.43.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2023-11-20_ ](https://git-scm.com/docs/gitrepository-layout/2.43.0)
  12. 2.39.1 → 2.42.4 no changes
  13. [2.39.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2022-12-12_ ](https://git-scm.com/docs/gitrepository-layout/2.39.0)
  14. 2.25.1 → 2.38.5 no changes
  15. [2.25.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2020-01-13_ ](https://git-scm.com/docs/gitrepository-layout/2.25.0)
  16. 2.24.1 → 2.24.4 no changes
  17. [2.24.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2019-11-04_ ](https://git-scm.com/docs/gitrepository-layout/2.24.0)
  18. 2.22.1 → 2.23.4 no changes
  19. [2.22.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2019-06-07_ ](https://git-scm.com/docs/gitrepository-layout/2.22.0)
  20. 2.20.1 → 2.21.4 no changes
  21. [2.20.0 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2018-12-09_ ](https://git-scm.com/docs/gitrepository-layout/2.20.0)
  22. 2.18.1 → 2.19.6 no changes
  23. 2.18.0 no changes
  24. 2.17.0 → 2.17.6 no changes
  25. [2.16.6 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2019-12-06_ ](https://git-scm.com/docs/gitrepository-layout/2.16.6)
  26. [2.15.4 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2019-12-06_ ](https://git-scm.com/docs/gitrepository-layout/2.15.4)
  27. 2.13.7 → 2.14.6 no changes
  28. [2.12.5 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2017-09-22_ ](https://git-scm.com/docs/gitrepository-layout/2.12.5)
  29. 2.11.4 no changes
  30. [2.10.5 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2017-09-22_ ](https://git-scm.com/docs/gitrepository-layout/2.10.5)
  31. 2.7.6 → 2.9.5 no changes
  32. [2.6.7 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2017-05-05_ ](https://git-scm.com/docs/gitrepository-layout/2.6.7)
  33. [2.5.6 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2017-05-05_ ](https://git-scm.com/docs/gitrepository-layout/2.5.6)
  34. 2.2.3 → 2.4.12 no changes
  35. [2.1.4 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2014-12-17_ ](https://git-scm.com/docs/gitrepository-layout/2.1.4)
  36. [2.0.5 ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/green-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/red-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) ![](https://git-scm.com/images/icons/grey-dot.png) _2014-12-17_ ](https://git-scm.com/docs/gitrepository-layout/2.0.5)


Check your version of git by running
`git --version`
##  [](https://git-scm.com/docs/gitrepository-layout#_name)NAME
gitrepository-layout - Git Repository Layout
##  [](https://git-scm.com/docs/gitrepository-layout#_synopsis)SYNOPSIS
$GIT_DIR/*
##  [](https://git-scm.com/docs/gitrepository-layout#_description)DESCRIPTION
A Git repository comes in two different flavours:
  * a `.git` directory at the root of the working tree;
  * a _< project>_`.git` directory that is a _bare_ repository (i.e. without its own working tree), that is typically used for exchanging histories with others by pushing into it and fetching from it.


**Note** : Also you can have a plain text file `.git` at the root of your working tree, containing `gitdir:` _< path>_ to point at the real directory that has the repository. This mechanism is called a _gitfile_ and is usually managed via the `git` `submodule` and `git` `worktree` commands. It is often used for a working tree of a submodule checkout, to allow you in the containing superproject to `git` `checkout` a branch that does not have the submodule. The `checkout` has to remove the entire submodule working tree, without losing the submodule repository.
These things may exist in a Git repository.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objects)objects

Object store associated with this repository. Usually an object store is self sufficient (i.e. all the objects that are referred to by an object found in it are also found in it), but there are a few ways to violate it.
  1. You could have an incomplete but locally usable repository by creating a shallow clone. See [git-clone[1]](https://git-scm.com/docs/git-clone).
  2. You could be using the `objects/info/alternates` or `$GIT_ALTERNATE_OBJECT_DIRECTORIES` mechanisms to _borrow_ objects from other object stores. A repository with this kind of incomplete object store is not suitable to be published for use with dumb transports but otherwise is OK as long as `objects/info/alternates` points at the object stores it borrows from.
This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/objects" will be used instead.



[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objects0-9a-f0-9a-f)objects/[0-9a-f][0-9a-f]

A newly created object is stored in its own file. The objects are splayed over 256 subdirectories using the first two characters of the sha1 object name to keep the number of directory entries in `objects` itself to a manageable number. Objects found here are often called _unpacked_ (or _loose_) objects.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objectspack)objects/pack

Packs (files that store many objects in compressed form, along with index files to allow them to be randomly accessed) are found in this directory.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objectsinfo)objects/info

Additional information about the object store is recorded in this directory.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objectsinfopacks)objects/info/packs

This file is to help dumb transports discover what packs are available in this object store. Whenever a pack is added or removed, `git` `update-server-info` should be run to keep this file up to date if the repository is published for dumb transports. _git repack_ does this by default.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objectsinfoalternates)objects/info/alternates

This file records paths to alternate object stores that this object store borrows objects from, one pathname per line. Note that not only native Git tools use it locally, but the HTTP fetcher also tries to use it remotely; this will usually work if you have relative paths (relative to the object database, not to the repository!) in your alternates file, but it will not work if you use absolute paths unless the absolute path in filesystem and web URL is the same. See also `objects/info/http-alternates`.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-objectsinfohttp-alternates)objects/info/http-alternates

This file records URLs to alternate object stores that this object store borrows objects from, to be used when the repository is fetched over HTTP.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-refs)refs

References are stored in subdirectories of this directory. The _git prune_ command knows to preserve objects reachable from refs found in this directory and its subdirectories. This directory is ignored (except refs/bisect, refs/rewritten and refs/worktree) if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/refs" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-refsheadsname)refs/heads/`name`

records tip-of-the-tree commit objects of branch `name`

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-refstagsname)refs/tags/`name`

records any object name (not necessarily a commit object, or a tag object that points at a commit object).

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-refsremotesname)refs/remotes/`name`

records tip-of-the-tree commit objects of branches copied from a remote repository.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-refsreplaceobj-sha1)refs/replace/_< obj-sha1>_

records the SHA-1 of the object that replaces _< obj-sha1>_. This is similar to info/grafts and is internally used and maintained by [git-replace[1]](https://git-scm.com/docs/git-replace). Such refs can be exchanged between repositories while grafts are not.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-packed-refs)packed-refs

records the same information as refs/heads/, refs/tags/, and friends record in a more efficient way. See [git-pack-refs[1]](https://git-scm.com/docs/git-pack-refs). This file is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/packed-refs" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-HEAD)HEAD

A symref (see glossary) to the `refs/heads/` namespace describing the currently active branch. It does not mean much if the repository is not associated with any working tree (i.e. a _bare_ repository), but a valid Git repository **must** have the HEAD file; some porcelains may use it to guess the designated "default" branch of the repository (usually _master_). It is legal if the named branch _name_ does not (yet) exist. In some legacy setups, it is a symbolic link instead of a symref that points at the current branch.
HEAD can also record a specific commit directly, instead of being a symref to point at the current branch. Such a state is often called _detached HEAD._ See [git-checkout[1]](https://git-scm.com/docs/git-checkout) for details.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-config)config

Repository specific configuration file. This file is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/config" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-configworktree)config.worktree

Working directory specific configuration file for the main working directory in multiple working directory setup (see [git-worktree[1]](https://git-scm.com/docs/git-worktree)).

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-branches)branches

A deprecated way to store shorthands to be used to specify a URL to _git fetch_ , _git pull_ and _git push_. A file can be stored as `branches/`_< name>_ and then _name_ can be given to these commands in place of _repository_ argument. See the REMOTES section in [git-fetch[1]](https://git-scm.com/docs/git-fetch) for details. This mechanism is legacy and not likely to be found in modern repositories. This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/branches" will be used instead.
Git will stop reading remotes from this directory in Git 3.0.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-hooks)hooks

Hooks are customization scripts used by various Git commands. A handful of sample hooks are installed when _git init_ is run, but all of them are disabled by default. To enable, the `.sample` suffix has to be removed from the filename by renaming. Read [githooks[5]](https://git-scm.com/docs/githooks) for more details about each hook. This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/hooks" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-common)common

When multiple working trees are used, most of files in $GIT_DIR are per-worktree with a few known exceptions. All files under _common_ however will be shared between all working trees.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-index)index

The current index file for the repository. It is usually not found in a bare repository.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-sharedindexSHA-1)sharedindex.<SHA-1>

The shared index part, to be referenced by $GIT_DIR/index and other temporary index files. Only valid in split index mode.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-info)info

Additional information about the repository is recorded in this directory. This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/info" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-inforefs)info/refs

This file helps dumb transports discover what refs are available in this repository. If the repository is published for dumb transports, this file should be regenerated by _git update-server-info_ every time a tag or branch is created or modified. This is normally done from the `hooks/update` hook, which is run by the _git-receive-pack_ command when you _git push_ into the repository.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-infografts)info/grafts

This file records fake commit ancestry information, to pretend the set of parents a commit has is different from how the commit was actually created. One record per line describes a commit and its fake parents by listing their 40-byte hexadecimal object names separated by a space and terminated by a newline.
Note that the grafts mechanism is outdated and can lead to problems transferring objects between repositories; see [git-replace[1]](https://git-scm.com/docs/git-replace) for a more flexible and robust system to do the same thing.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-infoexclude)info/exclude

This file, by convention among Porcelains, stores the exclude pattern list. `.gitignore` is the per-directory ignore file. _git status_ , _git add_ , _git rm_ and _git clean_ look at it but the core Git commands do not look at it. See also: [gitignore[5]](https://git-scm.com/docs/gitignore).

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-infoattributes)info/attributes

Defines which attributes to assign to a path, similar to per-directory `.gitattributes` files. See also: [gitattributes[5]](https://git-scm.com/docs/gitattributes).

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-infosparse-checkout)info/sparse-checkout

This file stores sparse checkout patterns. See also: [git-read-tree[1]](https://git-scm.com/docs/git-read-tree).

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-remotes)remotes

Stores shorthands for URL and default refnames for use when interacting with remote repositories via _git fetch_ , _git pull_ and _git push_ commands. See the REMOTES section in [git-fetch[1]](https://git-scm.com/docs/git-fetch) for details. This mechanism is legacy and not likely to be found in modern repositories. This directory is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/remotes" will be used instead.
Git will stop reading remotes from this directory in Git 3.0.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-logs)logs

Records of changes made to refs are stored in this directory. See [git-update-ref[1]](https://git-scm.com/docs/git-update-ref) for more information. This directory is ignored (except logs/HEAD) if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/logs" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-logsrefsheadsname)logs/refs/heads/`name`

Records all changes made to the branch tip named `name`.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-logsrefstagsname)logs/refs/tags/`name`

Records all changes made to the tag named `name`.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-shallow)shallow

This is similar to `info/grafts` but is internally used and maintained by shallow clone mechanism. See `--depth` option to [git-clone[1]](https://git-scm.com/docs/git-clone) and [git-fetch[1]](https://git-scm.com/docs/git-fetch). This file is ignored if $GIT_COMMON_DIR is set and "$GIT_COMMON_DIR/shallow" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-commondir)commondir

If this file exists, $GIT_COMMON_DIR (see [git[1]](https://git-scm.com/docs/git)) will be set to the path specified in this file if it is not explicitly set. If the specified path is relative, it is relative to $GIT_DIR. The repository with commondir is incomplete without the repository pointed by "commondir".

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-modules)modules

Contains the git-repositories of the submodules.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-worktrees)worktrees

Contains administrative data for linked working trees. Each subdirectory contains the working tree-related part of a linked working tree. This directory is ignored if $GIT_COMMON_DIR is set, in which case "$GIT_COMMON_DIR/worktrees" will be used instead.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-worktreesidgitdir)worktrees/<id>/gitdir

A text file containing the absolute path back to the .git file that points to here. This is used to check if the linked repository has been manually removed and there is no need to keep this directory any more. The mtime of this file should be updated every time the linked repository is accessed.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-worktreesidlocked)worktrees/<id>/locked

If this file exists, the linked working tree may be on a portable device and not available. The presence of this file prevents `worktrees/`_< id>_ from being pruned either automatically or manually by `git` `worktree` `prune`. The file may contain a string explaining why the repository is locked.

[](https://git-scm.com/docs/gitrepository-layout#Documentation/gitrepository-layout.txt-worktreesidconfigworktree)worktrees/<id>/config.worktree

Working directory specific configuration file.
##  [](https://git-scm.com/docs/gitrepository-layout#_git_repository_format_versions)Git Repository Format Versions
Every git repository is marked with a numeric version in the `core.repositoryformatversion` key of its `config` file. This version specifies the rules for operating on the on-disk repository data. An implementation of git which does not understand a particular version advertised by an on-disk repository MUST NOT operate on that repository; doing so risks not only producing wrong results, but actually losing data.
Because of this rule, version bumps should be kept to an absolute minimum. Instead, we generally prefer these strategies:
  * bumping format version numbers of individual data files (e.g., index, packfiles, etc). This restricts the incompatibilities only to those files.
  * introducing new data that gracefully degrades when used by older clients (e.g., pack bitmap files are ignored by older clients, which simply do not take advantage of the optimization they provide).


A whole-repository format version bump should only be part of a change that cannot be independently versioned. For instance, if one were to change the reachability rules for objects, or the rules for locking refs, that would require a bump of the repository format version.
Note that this applies only to accessing the repository’s disk contents directly. An older client which understands only format `0` may still connect via `git://` to a repository using format `1`, as long as the server process understands format `1`.
The preferred strategy for rolling out a version bump (whether whole repository or for a single file) is to teach git to read the new format, and allow writing the new format with a config switch or command line option (for experimentation or for those who do not care about backwards compatibility with older gits). Then after a long period to allow the reading capability to become common, we may switch to writing the new format by default.
The currently defined format versions are:
###  [](https://git-scm.com/docs/gitrepository-layout#_version_0)Version `0`
This is the format defined by the initial version of git, including but not limited to the format of the repository directory, the repository configuration file, and the object and ref storage. Specifying the complete behavior of git is beyond the scope of this document.
###  [](https://git-scm.com/docs/gitrepository-layout#_version_1)Version `1`
This format is identical to version `0`, with the following exceptions:
  1. When reading the `core.repositoryformatversion` variable, a git implementation which supports version 1 MUST also read any configuration keys found in the `extensions` section of the configuration file.
  2. If a version-1 repository specifies any `extensions.*` keys that the running git has not implemented, the operation MUST NOT proceed. Similarly, if the value of any known key is not understood by the implementation, the operation MUST NOT proceed.


Note that if no extensions are specified in the config file, then `core.repositoryformatversion` SHOULD be set to `0` (setting it to `1` provides no benefit, and makes the repository incompatible with older implementations of git).
The defined extensions are given in the `extensions.*` section of [git-config[1]](https://git-scm.com/docs/git-config). Any implementation wishing to define a new extension should make a note of it there, in order to claim the name.
##  [](https://git-scm.com/docs/gitrepository-layout#_see_also)SEE ALSO
[git-init[1]](https://git-scm.com/docs/git-init), [git-clone[1]](https://git-scm.com/docs/git-clone), [git-config[1]](https://git-scm.com/docs/git-config), [git-fetch[1]](https://git-scm.com/docs/git-fetch), [git-pack-refs[1]](https://git-scm.com/docs/git-pack-refs), [git-gc[1]](https://git-scm.com/docs/git-gc), [git-checkout[1]](https://git-scm.com/docs/git-checkout), [gitglossary[7]](https://git-scm.com/docs/gitglossary), [The Git User’s Manual](https://git-scm.com/docs/user-manual)
##  [](https://git-scm.com/docs/gitrepository-layout#_git)GIT
Part of the [git[1]](https://git-scm.com/docs/git) suite
### gitrepository-layout
[About this site](https://git-scm.com/site)
Patches, suggestions, and comments are welcome.
Git is a member of [Software Freedom Conservancy](https://git-scm.com/sfc)
