DEV Community

Patrick Henry
Patrick Henry

Posted on • Updated on

Git: What happens under the hood

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.

Conclusion

I haven't learned all of Git and it is definitely not the most intuitive in the world, but I learned something very important.

SOFTWARE I USE IS NOT THAT DIFFICULT TO UNDERSTAND

All of the technology I use may take some time to get accustomed to, but all software is really just the same techniques I have been using all throughout my coding career. Control flow, loops, functions, scopes, closures, methods, data structures, algorithms, time complexity, etc. They are all used in every program, because they are all built on top of the same binary, on top of the same assembly language, all can talk to other computers with the same protocols. Really there are a few differences between code. The syntax, the time complexity/efficiency, and the design of the system(Database, Client, Server). The small or large decisions that you make when starting up a project are what decides how easy or difficult it will be to iterate on your project.

I think remembering the concept that all software is built on top of the same systems is the key for me to have a long career in software, mitigate imposter syndrome, and to CI/CD my current knowledge because there is always something else to learn, something else to explore, and something else that will be fun to build.

Sources on how to code

Code Crafters paid Any Language

Free

gitlet Code Git in Javascript

Git in Python

Ruby

Top comments (0)