DevOps Classroom notes 12/Nov/2023

Git Workflow

  • Developer:
    • For developing features
    • For fixing issues
  • Tester:
    • Automation Testers develop test scripts for automation
  • DevOps:

    • For maintaining DevOps Pipelines
    • For storing
      • K8s manifests
      • Dockerfiles
      • Terraform templates/modules
      • Ansible playbooks etc.
  • Ways of Working

    • GUI (Graphical User interface)
    • Commandline

Approach

  • Lets learn git
    • with single system
    • Add Remote (GitHub, Azure Source Repos, AWS CodeComit)
    • Branching Strategies
    • Hooks

Single System

  • Configurations
  • Creating local repositories
  • How to work for multiple customers/versions

To understand Git Simulate Developer

  • Lets create a configuration
  • On every git commit (label on carton box)
    • Who has done the change
      • name
      • email
    • When did the change happen
    • What was changed
    • What is the message (label)

Git configurations

  • Git has configurations of three types
    • System Config
    • Global config
    • local config
  • The configuration is a text file
    • key=value
  • Generally for user level information we use Global config
  • If there is a config special to a repository we use local config
  • To deal with configurations we have command
git config --help
  • Lets add a username and user email config at global level
git config --global user.name qtdevops
git config --global user.email qtdevops@gmail.com

Create a Repository

  • Create an empty folder
mkdir C:\temp\LearningGit\ltsalesman
cd C:\temp\LearningGit\ltsalesman
  • Now initalize the folder with git init to make it a git repository
git init

Preview

Create commits

  • Lets do some changes and execute git status
    Preview
  • git status command tries to show the status w.r.t to changes
  • lets add all the changes to staging area
git add .
  • lets check status
git status

Preview
* Now lets add all the changes from staging area into commit

git commit -m "<message>"
git status

Preview
* Lets view the commits

git log

Preview

Git deals with changeset (change)

  • Lets create two changes
    • one change in existing file (modified)
    • one new file (untracked)
  • untracked files in git status represent a new file add which was never part of history or commits
    Preview
  • Now lets add all the changes to staging area and them comit
git add --all

Preview
* Lets view history
Preview
* Lets draw an tree view of git
Preview

Note

  • Home Directory:
    • Windows: C:\users\<username>
    • Mac: /Users/<username>
    • Linux: /home/<username>
  • Refer Here for installing necessary softwares in Windows
  • IDE (Integrated Developer Environment)
    • Eclipse/IntelliJ (Java)
    • Visual Studio (.net)
    • PyCharm/Spyder (python)
    • Visual Studio Code (any language)
  • We will be using visual studio code

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner