DevOps Classroom Series – 25/Nov/2021

How Git Works

  • Git is a stupid content tracker
  • To understand git lets first understand hashing.
  • Hashing is the process of converting a given key/text (any length) into another smaller value (fixed size string or number).
  • Hashing algorithms
    • md5
    • SHA1
    • SHA256
  • Git Use SHA1 hashing to track contents
  • Lets go to .git/HEAD which will point towards a branch (.git/refs/heads/<branch>)
  • In the branch file we will have the latest commit id of the branch
  • The plumbing command git cat-file -t <id> will show the type and git cat-file -p <id> will print the contents
  • In Git we have following types
    • tree:
      • This represents a folder or directory
    • blob:
      • This represents a file
    • commit:
      • This represents a commit
  • Commit is SHA-1 Hash of
    • contents (Changes)
    • author
    • message
    • parent commit
  • Lets use some plumbing commands on master and try to build the tree
  • Since we have a basic idea, lets create a new git repository and then create three commits
  • For commands used refer classroom video
  • Lets try to create a branch ‘develop’ make one commit in it and also one commit in master branch. then merge the chagnes from develop to master branch
  • As of now we are good with three areas of git
  • Next Steps:
    • Lets focus on fourth area of git i.e. Remote Repositories

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%