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>

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

Cloning the repository

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

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
  • Staging Area
  • Now we can commit the changes with a message
  • Git log
  • Graph representation
  • 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 ReplyCancel reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design 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%%