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

See Git - Getting Started

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

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

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 *...
Git - Fork (Upstream)

A fork is an entire copy of a repository. The original repository of a fork is known as the upstream repository. It has the same concept as a upstream branch. see To sync your local repo with...
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 - Objects (Database)

An object is the value in the entry of the git database key-value. All entities in git are objects. Objects are the entity of the Git file system. On the operating file system, the objects are stored...



Share this page:
Follow us:
Task Runner