How does git work internally

Image result for git

A Friendly introduction

Why (Version Control Systems) — VCS

Git — from the guy who wrote kernel

Walking to the door

Opening the door..

.git directory

$ mkdir apple
$ cd apple
$ git init
$ ls -1 .git

Hey!! you are now inside ..

git add (hard way)

$ touch myfile.txt
$ git hash-object -w myfile.txt
$ find .git/objects -type f
$ git cat-file -p e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
$ echo "Hello Git" > myfile.txt 
$ git hash-object -w myfile.txt
$ git cat-file -p 9f4d96d5b00d98959ea9960f069585ce42b1349a
$ git update-index --add --cacheinfo 100644 \ 9f4d96d5b00d98959ea9960f069585ce42b1349a myfile.txt
$ git ls-files --stage

git commit (hard way)

$ git write-tree
$ echo "first commit" | git commit-tree \ 6e9432aeedbad83fbffb7f8aae4a5d1ab50b7fdf
$ git cat-file -p 1658642a6c164700c880d499da0b874c18829883
$ git log --stat 1658642a6c164700c880d499da0b874c18829883
$ echo "Hello Git Pro" > myfile.txt
$ git update-index myfile.txt
$ git write-tree
$ echo "second commit" | git commit-tree \ 075e4ae2beb7edf5fda9fef8beba34a52f60a957 -p \ 1658642a6c164700c880d499da0b874c18829883
$ echo 314f04395e5e7c70d9f40d681c2f4c84237a7fea >  .git/refs/heads/master
$ git log
Note : This is not structure of our scenario. just to show the graphical view

Conclusion

References

Useful links

Neutralinojs

Programmer | Author of Neutralinojs | Technical Writer