Git Essentials

vinay mavi
Experience Technology
3 min readMar 28, 2018

--

I have started my journey with a startup where I was the only developer, the team starts growing slowly and we start getting large number of code merge problem on the daily basis then we start exploring the solutions by googling, calling to seniors after this long exercise we got an idea that we need a version control system.

The Total focus moved to what is version control system and after some research, we got idea what is version control and decided to use Git, now code collaboration is getting smooth.

One day I have created a tag on my release branch and two days later deleted this branch but got surprised, can still able to switch my branch to this particular tag then decided to dig down Git to understand how it is work.

As Git has four states of git files and it’s not making patches instead

states of git file

records snapshots of files and every snapshot stored inside .git directory of the repository with a unique hash, to more precise it store all object inside .git/objects folder. when we add a new file then git stored its snapshot 55(snapshot folder name in video).

Git add stash object.

git has a file in stage state now we can do a commit and this commit would create two more objects 30(hash name in .git/object) a commit type object and f1(hash name in .git/objects) a tree type object

git commit objects

Git has total four type of object
— Blob
— Tree
— Commit
— Tag

A git commit object has a pointer to its parent, pointer to tree and string of

Git commit internal

commit message, tree object has pointers to blobs and a blob contains a snapshot of current state of a file.

we did tree commits and created a tag v1.0 on the current state and deleted

git tag and master pointer

the master branch, now still we can switch repository to tag v1.0 as HEAD, branch and, tags are just pointer that points to a particular commit object.

References —

https://www.siteground.com/tutorials/git/directory-structure/
https://githowto.com/
https://githowto.com/git_internals_git_directory
https://www.codeschool.com/learn/git
https://git-scm.com/book/en/v2/Git-Internals-Git-Objects

--

--

vinay mavi
Experience Technology

Vinay is a Cloud Architect, T Shape Developer, Blogger, A Open Source Contributor, Reverse Mentorship Believer.