Git: What happens under the hood

What is Git? Git is a open source version control system that has had a stranglehold on the development world
since it came out in 2005. Created by Linus Torvalds it is the system that he created to fix some problems with
the old version control systems of the day.

History

Linus Torvalds created Git because at the time there were many version control systems some open-source and
others were not open-source. It was a fractured time for version control of the day. Linus felt forced to make a
change in the community when the version control system he was using decided to start charging for the system that
they were using and Linus didn’t want to pay. He was already a successful engineer already having been the father
of the Linux Kernel already and having a team of developers working on it when their version control system decided
to start charging for the service. So he got to work and created on of the most influential tools in the developer
tools to date.

Parts of the .git folder

What is git and how does it work? What ‘makes’ a directory a git repo? What is a repository? Git is an extensive
tool that takes alot of time to get used to all of the features and understand what is actual happening under the
hood. A git repository is just a folder that has another nested .git folder that holds staged changes in it. The
important folders are refs, heads, config, logs, and objects.

How it Works

refs directory

refs holds all the references to the heads of different branches of your git repository. It is important to hold all
your branch heads no matter the branch your on so that you can always go back whenever you would like.

objects directory

The objects directory is where all of your git changes are actual stored compressed in different folders to hold your
changes. The sha1 is the file directory of your current git commit you are on.

config

Sets the config of your git repo locally. Things like if you want your pulls to rebase, remote branches, your origin
repo, etc.

logs

Directory to hold your git branch trees to see what your git tree looks like extensively.

heads

holds all of the heads to your different head branches in Git.

Sources on how to code

Code Crafters paid Any Language

Free

gitlet Code Git in Javascript

Git in Python

Ruby


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

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

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top