DevOps Classroom Series – 18/Nov/2021

Git

  • Git is a free & open source distributed version control system, designed & Implemented by Linus Torvalds to handle from small to very large projects with speed and effeciency
  • Installing Git:
    • Windows: Refer Here
    • Mac: brew install git
    • Linux:
      • Debian: sudo apt install git -y
      • RedHat: sudo yum install git -y
  • Configuring git
git config --global user.name 'qtdevops'
git config --global user.email 'qtdevops@gmail.com'
  • Tip for git commands:
    • Try using any cheatsheet which you like Refer Here for cheatsheet from atlassian
  • Creating a Repository using Git:
    • Navigate to any directory in your system and create a folder called as helloworld
    • Initialize a repository
  • Three Areas of Git
    • Intro
    • Commit Workflow
      • Demonstration:
        • Lets create a new file called as ‘Readme.md’ (in linux/mac use touch Readme.md)
        • Now we had made changes in the working tree. Lets check the status using git status
        • Now lets add the change to the staging area
        • To commit a version into git repository git needs
          • commit message => This describes the purpose
          • commit author username => username will be recorded in the version history
          • commit author email => email of the user will be recorded in the history
          • Datetime of commit => When the commit was made
        • In the git configuration we have already configured username and email
        • Now lets do the commit git commit -m <message for the version to be created>
        • Now lets look at history git log
        • Git log will show
          • commit: This is unique commit id which represents a version
          • Author: The author of the commit
          • Date: Date time of the commit
        • Now lets make a change in the working tree. Add some text to Readme.md file
        • Lets add the change to the staging area
        • Now lets try to commit the changes from staging area
    • Understading HEAD pointer
      • HEAD is a pointer which represents the contents of working tree
      • Now lets move head to the previous commit git checkout <previous commit id>
      • Now lets move the HEAD back to latest version git checkout master
    • Exercise:
      • Initialize a new Repository in your system
      • Create a new file and create a new version in the repo
      • As a second change try to create a directory called as src and create a new version in the repo

Leave a comment

Turn on JavaScript to leave a comment.

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company
Exit mobile version
%%footer%%