DevOps Classroom Series – 04/Feb/2021

Git Contd..


  • Repository: In short repository is totality of the history of your software project.

Practical Scenarios

  • Create a local repository
    • Create any empty folder Preview
    • Open this folder in any terminal (Powershell, Git Bash) Preview Preview
    • Now initialize the repository by executing git init Preview
    • When we initialize the repository a .git folder is generated Preview
  • Three areas in git on your local system Preview
  • Now lets make changes in working tree
    • Create a file in working tree Preview
    • Now lets ask git what is the status by executing git status Preview
    • Understanding add and commit Preview
    • Now lets add the change of working tree to index area Preview
    • Now lets commit the changes to local repo. But before we commit the changes, commit needs
      • email id
      • username
      • message
    • Email id and username can be configure once per system, let do it Preview
    • Message is given for every commit git commit -m <message of commit>
    • Now lets commit our change from index area to local repository Preview
    • We had commited the changes from working tree to local repo via index area (staging area). Now lets see what the git status is Preview
    • Now lets see the history of the repository by executing git log Preview
  • Now lets make one more change by adding some text to Preview
  • Lets see what git status tells Preview
  • Now lets add this change to indexing/staging area Preview
  • Now lets commit the change from staging area to local repo Preview
  • In GIT, Head is pointer to commit id. By default HEAD points to the latest commit. We can also travel back to older commits
  • Note: Try using any cheatsheat of your choice to get used to commands Refer Here
  • In Git to make changes we move the changes from one phase to other, So we might see some of documents referring git as phased commit.
  • So now lets make some more changes by create two empty folders in working tree Preview
  • Now lets execute git status Preview
  • For git, changes are considered at file level, empty folders are not considered as changes in git.

Leave a Reply

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

About learningthoughtsadmin