DevOps Classroom notes 20/Nov/2024

Git (Contd)

Git Commit

  • Commit needs the following
    • changes
    • username
    • email
    • message
    • datetime (of commit)

Configuring email and username

  • execute the following commands
git config --global user.name <username>
git config --global user.email <emailid>

Preview

Initializing the repository

  • When we want to create a local repository (when remote doesnot exist)
  • Create a new folder
mkdir <folder>
  • initailze
cd <folder>
git init

Preview

Cloning the repository

  • Your organization is already having the code in some remote location (github)
    Preview

Lets focus only on local repo

  • Working tree
  • When we make changes in the working tree, we have two types of status ()
    • untracked: This file doesnot have any history (new file)
    • Changes not staged for commit: These files have history and now are modified
      Preview
  • Staging Area
    Preview
  • Now we can commit the changes with a message
    Preview
  • Git log
    Preview
  • Graph representation
    Preview
  • Every commit has a unique commit id

Hashing and Git

  • Git uses hashing and to be specific SHA1 hasing algorithms
  • A Git commit is sha 1 hash of
    • changes
    • previous commit
    • date time
    • username and email
    • message
  • Every file which you add to the history is represented as object and contents are stored with hash id
  • Every folder is represented as tree

Commands used sofar

  • git config –global
  • git init
  • git add
  • git commit -m
  • git status
  • git log
  • git cat-file -p

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