Quick explaination of how git works
Soheil Pasbakhsh
Tech-Driven Frontend Lead & Backend Developer | Expertise in JavaScript, Typescript, React.js, Node.js, Nest.js
Almost every developers uses git for their day to day task, but not every one knows about how it actually works.
If you initialize a git repository using the following command
git init
Or when you clone from a repository there will be a file with the name of .git
Inside it there are several files and folders
The HEAD file:
one of the most important file is HEAD. If you open it, you'll see something like this:
ref: refs/heads/main
which points to refs/heads/main file inside the .git folder
The refs folder:
Inside the refs folder there are files for all of the branches in repository.
In this case if you open refs/heads/main, you'll see a commit hash similar to this:
0e5bebf911df44080b0e5617e348436c0997e017
This is the hash of the commit That is used for tracking changes by git.
The objects folder:
The latest versions of the actual files in the repository will be stored as blob inside the object folder
The logs folder:
The reference of everything that happenes in repository will be stored in logs folder, which allows git to maintain history of events.
The hooks folder:
The hooks folder contains the custom scripts that can be executed at different stages of git workflow, such as "pre-commit", "pre-push" and other hooks which used for automating task like linting before push
Software Engineer At HasinGroup ?Maani?
1 个月??????
Back-End Developer at HasinGroup(Maani)
1 个月??????????