InfoparkDailyCAREER TOOLS

Git · Lesson 2 of 6

Repositories & commits

git init, status, add, commit and log — the everyday cycle.

A repository (repo) is a project folder that Git tracks. git init turns the current folder into one.

Files move through three areas:

  1. Working directory — your files as you edit them.
  2. Staging area — changes you've chosen for the next snapshot (git add).
  3. Repository — saved snapshots called commits (git commit).

git status shows where everything is — run it often. Write commit messages in the imperative, describing why: “Add salary filter to job search”.

Example in the terminal

Run these on your own computer
$ mkdir job-tracker && cd job-tracker
$ git init
Initialized empty Git repository in /home/anu/job-tracker/.git/

$ echo "# Job tracker" > README.md
$ git status
Untracked files:
  README.md

$ git add README.md
$ git commit -m "Add project README"
[main (root-commit) 3f2c1aa] Add project README
 1 file changed, 1 insertion(+)

$ git log --oneline
3f2c1aa Add project README

Lines starting with $ are commands you type; the rest is what Git prints. Names and URLs are examples.

Key points

  • init → add → commit is the core loop.
  • git status is your dashboard.
  • Small commits with clear messages are easier to review and undo.

Quick check

Which command moves changes into the staging area?

Practice task

Create a folder, init a repo, add two files in two separate commits, then view them with git log --oneline.

Interview corner

What is the staging area for?

It lets you choose exactly which changes go into the next commit, so one commit can contain one logical change even if you edited many files.

What makes a good commit message?

A short imperative summary line (≈50 characters), optionally a blank line and a body explaining why the change was needed.

Further reading

Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.

Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.