DevOps Classroomnotes 12/Jul/2023

How Git Works

  • Current repository changes
    Preview
  • To understand we will be using plumbing commands
git cat-file -t <commit-id>
git cat-file -p <commit-id>
  • Commit is an SHA-1 hash of
    • parent
    • author
    • message
    • date time
    • contents
  • Git reference objects
    • branch
    • tag
  • What is branch in git?
    • Branch is a reference object which points to some commit id, Branch points to a new commit id when a new commit happens
  • What is tag in git?
    • tag is a reference object which points to some commit id and doesnot move with new commits
  • Lets figure from latest commit on develop branch 3306f46
    Preview
  • tree in git represents folder/directory and blob/object represents file
  • lets view contents of tree in latest commit
    Preview

Merging Changes between Branches

  • Consider the following history
    Preview
  • we need changes from develop branch into master branch
  • now checkout to master and then execute merge
git checkout master
git merge develop
  • When git cannot merge changes due to different content in same lines it will raise conflicts.
    Preview
  • After fixing conflicts, add the changes and commit them which leads to creation of new commit with two parents
    Preview
    Preview
  • This is called as three way merge
  • Consier the following
    Preview
  • We need to have all the changes in develop branch into master
    Preview
    Preview

Terms

  • Hashing

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube