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 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

A newly-initialized .git directory typically looks like:

config
description
HEAD
hooks/
info/
objects/
refs/

where:

Management

Create

Location

  • The default location is the first subdirectory your project home (ie where you have run git init)
  • 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


Powered by ComboStrap