Ravindra BagaleCourses & study guides मराठी

Chapter 2: Git, GitHub and Git Bash

Chala mitrano, aaj aapan Git, GitHub aani Git Bash shikuya. Zip folder pathavnyachi paddhat sodun, history sobat code save karaycha. Git mhanje tool, GitHub mhanje website, Git Bash mhanje Windows var terminal. Clone, .gitignore, safe undo, HTTPS aani SSH. Ghabru naka: pahilya vela commands jast distat, pan teen meaningful commits kele ki flow lakshat rahto.

What you will learn in this chapter

  • Why a zip folder loses the story
  • Git vs GitHub vs Git Bash
  • Repository, remote and origin
  • init, status, add, commit, the staging area, and log
  • clone, .gitignore, and a safe undo
  • HTTPS vs SSH, including ssh-keygen, and git remote -v

Concepts in this chapter

  1. 2.1Why Git — zip folders vs history
  2. 2.2Git vs GitHub vs Git Bash
  3. 2.3Repository, remote and origin
  4. 2.4Install check and first vocabulary
  5. 2.5init, status, add, commit — first repo
  6. 2.6The staging area — mental model
  7. 2.7clone — copy an existing repo
  8. 2.8.gitignore — keep junk and secrets out
  9. 2.9git log — read the story
  10. 2.10Undo safely — restore and amend
  11. 2.11Commit message hygiene
  12. 2.12HTTPS vs SSH, and git remote -v
  13. 2.13Lab — three commits and one remote

The chapter recap is at the end of the last concept page.

Practice Tasks

About this scenario

Suppose we are on the DevOps team at Siemens, the industrial engineering company, working from Munich. Lukas Becker leads the team, and we look after the machine sensor dashboard. Costs are counted in EUR. In the tasks below we do real DevOps jobs on this project using what this lesson teaches. Siemens is a real company, but this project, the people, servers, IP addresses and numbers are made up for practice.

0 / 12

Easy Set your Git email

Why: GitHub links commits to your account using this email.

What to do: Set the global Git email to lukas@siemens.example.com.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Set your Git user name

Why: Every commit records who made it. A wrong name makes history confusing.

What to do: Set the Git user name to "Lukas Becker" for all repositories on this laptop.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy List all files with details

Why: Hidden files (like .env) and file sizes or owners only show with the right options.

What to do: Show a long listing of every file, including hidden ones, in /var/www/siemens.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Stage every change

Why: Before the first commit you usually want every new file included.

What to do: Stage every new and changed file in the current folder and below.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Stage one file

Why: Only staged changes go into the next commit.

What to do: Stage only the file Dockerfile for the next commit.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Clone a repository

Why: Cloning gives you the full project and its history on your machine.

What to do: Download the repository https://github.com/siemens/siemens-machine-sensor.git to this machine.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Commit with a message

Why: A clear message tells the team why the change was made.

What to do: Commit the staged changes with the message "Add health check to machine-sensor".

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Start a new Git repository

Why: Git can only track changes inside a folder that is a repository.

What to do: We are inside the new folder for the Siemens machine sensor dashboard. Turn this folder into a Git repository.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Easy Create nested folders in one go

Why: Projects need a clean folder tree. Making all levels in one command saves time and avoids errors.

What to do: Create the folder /srv/siemens/reports/2026 for Siemens. The parent folders do not exist yet, so create them too.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Easy Show where you are

Why: Before you copy or delete anything, you must know which folder you are in.

What to do: Lukas Becker logged in to the Siemens server and is not sure which folder the terminal is in. Print the current folder path.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Click Check answer.

Medium Stage tracked files and commit in one go

Why: For small fixes to tracked files, one command saves time.

What to do: Stage all already-tracked changed files and commit them with the message "Fix port 8000" in one command.

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Medium See staged changes

Why: Reviewing exactly what will be committed avoids surprises in review.

What to do: Show the line-by-line changes that are staged (not the unstaged ones).

How:
  1. Read the task and pick the tool it needs (git, docker, kubectl, terraform, ansible...).
  2. Write the tool name, then the sub-command (the action word).
  3. Add the flags the task needs, each followed by its value.
  4. Add names, files or paths at the end, then click Check answer.

Ravi Sir's Cards: 29 revision, interview and comparison cards for this chapter · मराठी cards