What is the Git Repository (Directory) ?

About

This page is about the notion of repository and how it's implemented in Git.

The git repository is a subdirectory named .git called also GIT_DIR that contains all repository files.

It contains :

When you are working in git on the local file system (file explorer,..), you are working in the working area/tree which is by default a checkout of the head (the last commit in the current branch).

Directory Layout / Subdirectories

A newly-initialized .git directory typically looks like:

config
description
HEAD
hooks/
info/
objects/
refs/

where:

Bare

A bare repository 1) is an empty repository that was created on a server to be able to receive their first push.

Creation

git init --bare

Management

Create

See Git - Getting Started

Location

  • The default location is the first subdirectory of your project home (ie where you have run git init) called also the root of the working tree
  • Otherwise you can set it:
    • as option via the –git-dir option of the git command line
    • or via the GIT_DIR environment variable.

Example to list the branches

git --git-dir .\subdirectory\.git branch

Private / Public

Strategy:

  • use private submodule by adding /.gitmodules to gitignore and share it amongst developers via a back-channel.
  • 2 different repositories where the relationship is build using symlinks (the ide should support it)

See also installing-projects-from-source

Sub-Project / Sub Repository

See Git - SubProject





Discover More
Git

is a content-addressable file system used to track directory tree content (as defined by its creator Linux Torvald) It's not a version control...
Git - Blob

blob in git is a object of the blob type that corresponds / represents the file contents (or inodes) in the git file system. file This command will put a blob in the object database where: the...
Git - Clone

git clone creates a clone known as local repository from a remote repository. cloning in git means: downloading the remote repository into a newly created directory setting for each downloaded branch...
Git - Config

The git config command. The name is actually: the section and the key separated by a dot. The value will be escaped. Example: where: core.editor is the name whereas: core is the section...
Git - Database

The git core database is a key store value where a key value entry is known as an object. (All data in Git are objects) The database is mostly composed: of tree of object ... and commit...
Git - Getting Started

An article that takes the basic steps in order to set up a Git repository When you want to set up a repository, you face generally two options: you want to create a fresh install from a Git repository...
Git - Git (executable|command line)

The git executable where: --git-dir is the location of the repository files --work-tree is the location of the work tree Command Description add Add file contents to the index add--interactive...
Git - How to download only a directory

This page is how to download a part of a git repository Example with curl if you want to download only the directory located at subir/subdir example: codesandbox
Git - Remote (Tracked Repository)

A remote in Git is a remote repository (ie a remote git server). Git remote manage the set of repositories (“remotes”) whose branches you track. They are also called tracked repositories in reference...
Git - SubProject

How to integrate subproject into a main project. (ie code dependency) sub-module creates a link to a repository (no file, no commit, no history is saved within the main project repository) sub-tree...



Share this page:
Follow us:
Task Runner