🤓
Thomas lab
Git&Github
Git&Github
  • Fetching & Pulling
  • Git alias
  • Git & Github : What is in .git ?
  • Git Rebase
  • Git reflog
  • Git Stash
  • Git tags
  • Git Workflow(Collaboration)
  • Quick High-Level
  • Git diff
  • Git installer
  • Reset & Revert commit
  • Github Collaborators
  • Github Basics
  • Introducing Git
  • Merging Branch
  • How to use multiple account
Powered by GitBook
On this page
  • 1.Config .
  • 2.Refs Folder
  • 3.Head
  • 4.Index
  • 5.Objects Folder
  • 4 types of Git Objects
  • Blob
  • Tree
  • Commits

Git & Github : What is in .git ?

In .git folder m you can see the list of folders:

  • object

  • config

  • head

  • index

  • refs

1.Config .

The config file is for...configuration. We've seen how to configure global settings like our name and email across all git git repos , but we can also configure thing a per-repo basis .

2.Refs Folder

Inside of refs, you'll can a head directory. refs/heads contains one file per branch in a repository/.Each file is named after a branch and containers the hash of the commit at the tip of the branch .

For example refs/heads/master contains the commit hash of the last commit on the master branch .

refs also contain a refs/tags folder which container one file for each tag in the repo

3.Head

HEAD is just a text file that keep track of where the head points

If it container refs/heads/mater,this mean that HEAD is pointing to the master branch.

In detached HEAD ,the HEAD file contains a commit hash instead of a branch reference

4.Index

The index file is a binary file that contains a list of the files the repository is tracking. It stores of fil names as well as some metadata for each file.

Not the the index does NOT store the actual content of files.It only containes references to files.

5.Objects Folder

The objects directory contains all the repo files. This is where Git stores backups of files, the commit in a repo and more .

The files are all compressed and encryted, so they wn't look like much!

4 types of Git Objects

  • commit

  • tree

  • blob

  • annotated tag

git manager each file by keys and value

example :

Write file
echo 'hello' | git hash-object --stdin -w
output :

Read file
git cat-file -p <hash-code>

Blob

git Blobs (binary large object are the object) are the object Git uses to store the contents of file in a given repository. Blobs don't even include the filenames of each file or any other data. They just store the contents of a file

Tree

Trees are git objects used to store the contents of a directory. Each tree contains pointers that can refer to blobs and to other trees .

Each entry in a tree contains the SHA-1 hash of a blob or tree, as well as the mode,type, and filename .

Commits

Commit object combine a tree object along with information about the context the led to the current tree. Commits store a reference to parent commits(s),the author. the commiter, and of course the commit(s), the author, the commiter, and of course the commis massage !

PreviousGit aliasNextGit Rebase

Last updated 8 months ago