DevOps Classroom Series – 04/Feb/2021

Git Contd..

Terms

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

Practical Scenarios

  • Create a local repository
    • Create any empty folder
    • Open this folder in any terminal (Powershell, Git Bash)
    • Now initialize the repository by executing git init
    • When we initialize the repository a .git folder is generated
  • Three areas in git on your local system
  • Now lets make changes in working tree
    • Create a file in working tree
    • Now lets ask git what is the status by executing git status
    • Understanding add and commit
    • Now lets add the change of working tree to index area
    • 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
    • Message is given for every commit git commit -m <message of commit>
    • Now lets commit our change from index area to local repository
    • We had commited the changes from working tree to local repo via index area (staging area). Now lets see what the git status is
    • Now lets see the history of the repository by executing git log
  • Now lets make one more change by adding some text to Readme.md
  • Lets see what git status tells
  • Now lets add this change to indexing/staging area
  • Now lets commit the change from staging area to local repo
  • 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
  • Now lets execute git status
  • For git, changes are considered at file level, empty folders are not considered as changes in git.

Leave a ReplyCancel reply

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

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