DevOps Classroomnotes 11/Sep/2022

Exercises

  • Create a new folder anywhere in your system and make it a git repo
  • Create 3 folders and check for status
  • now add a file in first folder and then execute git status
  • add this change to staging area
  • create one more file in second folder and add this change also to staging area
  • Now commit the change
  • Draw a tree like what we have done in the class git log --oneline
  • Now create two files in third folder, add them to staging area and now remove one file from staging area and create 2 commit.
  • Update your tree
  • now add the file which you moved from staging area to working tree back to staging ared and then create a third commit
  • Now create two files each in three folders add all of them to staging area
  • Clean the above changes as if you have not done any changes after 3 commit.

Preview

Some popular but correct opinions

  • Git is a Stupid Content Tracker
  • Linus Torvalds has a built a new file system which can track contents
  • Lets understand how git works
  • When we initialize git repository
    • .git folder gets created
    • HEAD pointer points to a default reference which is master
    • Reference will point to a specific commit id
  • Create a first commit on some folder after initalization.
    Preview
  • Now lets use a plumbing command git cat-file
    • git cat-file -t shows the type
    • git cat-file -p shows the contents
  • Git uses SHA-1 Hash to store objects.
  • Git has following object types
    • tree => folder
    • blob => file
    • commit
  • Lets find out the type and contents of commit id
    Preview
  • Now lets find the contents of tree
    Preview
  • Lets find the contents of file i.e. blob main.py
    Preview
  • main.py is empty
  • Now lets some content and create a second commit
  • please refer video for the rest of images on how git works.

Git Branches

  • Git by default create a branch which is called as master
  • Branch will point to a latest commit done in it.
  • To create a new branch from existing branch git branch <branch-name>
    Preview
  • Now lets make some changes in rel_1.0_siemens, to do this HEAD should be pointing towards rel_1.0_siemens for this we use checkout
    Preview
  • Now lets add some changes as discussed in the class
    Preview
    Preview
  • Next Steps:
    • A change done in the master branch should be made available to both siemens and ge branch
    • A commit in ge branch should also be applied to siemens branch
    • Adding multiple users i.e.Remote Repository
      • pull
      • fetch
      • push
      • remote branches
      • remote repos
      • origin
    • All the changes done for siemens and ge to be merged to common branch
    • The above activities can be address
      • merge
      • rebase
      • cherry pick
      • merge – conflicts

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 Responsive Web Designing 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