DevOps Classroom Series – 28/Apr/2020

Understanding Git

  • To understand Git, we need to understand 5 areas of git
  • Lets start from folder level
  • Create an empty directory
mkdir learning
  • Lets make this folder intelligent with Version Control,
cd learning
git init
  • Lets start our journey with three areas of git
    • Working Tree/Working Directory
    • Staging Area
    • Local Repository
  • BY adding git init we have made learning folder as repository Preview
  • If you want physical locations according to above example Preview
  • Now make some changes and execute the following commands
touch  readme.txt
  • Now the git status command will describe the changes to the developer Preview
  • The changes are in working tree and we need to move the changes from working tree to staging, This operation is called as add (We are adding changes)
git add --help
# add all the changes in current directory
git add .
git status

Preview

  • Now we need to move the changes from staging to local repository, bcoz local repository has all the feature which we need in Version control System. This operation is as commit and to perform this operation, git should know your username and your email id
git config --global user.name "qtdevops"
git config --global user.email "qtdevops@gmail.com"

Preview

  • Now lets add changes from staging area to local repository
git commit -m "This is my first commit"
git status
git log

Preview

  • Now let this developer add one more change, add some text to existing file and create a new file Preview

  • Add these changes to staging area and then local repo Preview

  • Terms:

    1. Untracked: Is a file which was never part of local-repository. Newly added files are generally untracked
    2. Modified: Making changes to existing file in local repository
    3. Color Significance:
      • Red => Working Tree
      • Green => Added to staging area
  • Workflow: Preview

  • Dont Remember git commands use cheatsheets Refer Here

Leave a Reply

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

About learningthoughtsadmin