learn git.
0/25 done
learn git/the basics/course 09 of 25

The daily loop: edit, add, commit

Ninety-nine percent of using git is these three moves, repeated for years.

6 min read·2 sections·3 tasks
the key idea

The loop is edit → status → add → commit, and it never changes — everything else in git is built around it.

01The loop, spelled out

Everything you have learned compresses into one habit. You edit files — that is your actual work, the reason for all of this. Then you check what changed with git status. You stage what belongs together with git add .. You take the photograph with git commit -m "...". Then you do it again, and again, all day, for years.

Each trip around the loop takes about ten seconds and buys a permanent, labelled save point. Ten seconds now is the price of being able to answer any question about your project's past, forever.

[bash]· the loop you will repeat forever
# ...you work on files...

git status            # see what changed
git add .             # stage it
git commit -m "say what you did"

git status            # clean again
Small commits beat big ones

One idea per commit. If you fixed a typo and added a new page, that is two commits. Small photographs are easy to read, easy to explain, and — if one turns out to break something — easy to undo without losing the rest.

02What a day really looks like

A morning of real work produces a rhythm like this: edit, status, add, commit, edit, status, add, commit. The commits pile up as short lines in the log — a diary of your project, written in ten-second instalments. At the end of the day, git log --oneline shows the story of what you did, and git status shows a clean tree: everything saved, nothing hanging.

Notice git status bookends the loop. Before, it tells you what changed so you can stage deliberately. After, it confirms everything landed. When anything in git ever feels confusing — now, or in five years — the first move is the same: run status, read it, breathe.

[bash]· a day, as seen by the log
9:00  git commit -m "fix crash when list is empty"
10:30 git commit -m "add dark mode toggle"
12:15 git commit -m "refactor save button"
17:00 git commit -m "start settings page"
Commit at natural pauses

The natural moments to commit: a fix works, a feature lands, you are about to try something risky. Those pauses are exactly what the messages will describe later.

>>

Practice

A todo list project is ready. Run the loop twice.

[practice]· a real terminal, safely simulated
practice terminal — everything here is simulated, nothing can break
type 'help' to see the commands this terminal understands
~/my-project (main) $
Your tasks0/3 done
  1. 01.Add a new line to todo.txt (use >> to append, not >).

    hint: Try: echo "buy milk" >> todo.txt

  2. 02.Commit the change.

    hint: git add . then git commit -m "add milk"

  3. 03.Create a second file shop.txt and commit it too.

    hint: echo "the shop is closed" > shop.txt then stage and commit