Git Repositories

A repository is a place where the history of your code is stored. It lives in a .git subdirectory of your working copy – a copy of the most recent state of the files you’re working on.

In your local computer you usually have got the following repositories:

stash: thisis a repository where you can commit your modifications while you work on different things. Stashing takes the dirty/current state of your working directory — that is, your modified tracked files and staged changes — and saves it on a stack of unfinished changes that you can reapply when you want to do so.

workspace: this is the filesystem place where your current files are. If you make a build with maven, this are the files that maven will look for.
index: this is the repository where you put the file that you want to commit later

index: this is the place were you put all your code modifications temporarily waiting for a commit. All the item addes here will committed in one single commit.

local repository: this is the .git folder that contains the following folder structure:





The hook  directory contains shell scripts that are invoked after the corresponding Git commands. For example, after you run a commit, Git will try to execute the post-commit script.

The info directory contains  additional information about the repository. Relatively uninteresting except for the exclude file that is used to ignore files for this project, but beware! It’s not versioned like a .gitignore file would be.

The objects directory is where the data of your Git objects is stored. All the contents of the files you have ever checked in, your commits, trees and tag objects. The files are stored by their SHA-1 values. The first two characters are for the subdirectory and the next 38 are the filename. For example, if the SHA-1 for a blob we’ve checked in is a576fac355dd17e39fd2671b010e36299f713b4d the path to the corresponding file is: [GIT_DIR]/objects/a5/76fac355dd17e39fd2671b010e36299f713b4d

The refs directory  is the master copy of all refs that live in your repository, be they for stashes, tags, remote tracking branches, or local branches.

remote repository: when collaborating with others developers this is the place where all put the code modifications they want to share with you

Leave a Reply

Your email address will not be published. Required fields are marked *