Hashing
- Hashing algorithms are used to generated a random number.
- If the message is same, Hash will be same
- There is no way to generate message from hash
- Alogrithms
- MD5
- SHA1
- SHA256
Lets Dive into How git works
- To understand git we will be using two plumbing commands
git cat-file -t
# it tells the type of what you are looking at
git cat-file -p
# it prints the values
- We have done 3 commits
- Lets find the type and contents of latest commit
- parent refers to previous commit
- author/commiter is username and email configured
- message
- tree in git refers to folder/directory & blob refers to file
- Lets see the contents of previous commit
- Lets figure out the contents of first commit which is tree
b8d76bc8378818320eee5e112d0b738feebc6c11
- Lets see the contents of file Readme.md
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
- Now go to the second commit and print the contents
- two blobs have same id as the contents are same, same hash is generated by SHA1 algorithm
- Lets see contents of src
- as hash is same even the contents of test also will be same.
- main.py is an empty file,so the Hash matches with README.md as this is also empty
- Lets see contents of latest commit
- Now the tree of latest commit