CodeAgeBy Sitezack
Git & CLI für Profis ⌨️Git auf der Kommandozeile meistern0 XP
Kapitel-Fortschritt0/5

Lektion 1 von 5

init, add, commit

Git verfolgt deinen Code in drei Bereichen: dem Arbeitsverzeichnis, dem Staging-Bereich und der Commit-Historie. git init legt das Repository an.

git add legt Dateien ins Staging; git commit -m friert eine Momentaufnahme in der Historie ein. Wir simulieren diese Bereiche mit Python-Listen.

# git add app.py       -> staging.append("app.py")
# git commit -m "msg"  -> commits.append({"message": "msg", "files": list(staging)})

🎯 Aufgabe

Mach ein git add, indem du "app.py" und dann "index.html" zu staging hinzufügst. Mach dann einen git commit: füge zu commits das Dictionary {"message": "Erster Commit", "files": list(staging)} hinzu und leere danach staging. Gib die Anzahl der Commits aus.

PRO-Lektion

Dieses fortgeschrittene Kapitel gehört zu CodeAge PRO. Schalte es frei, um dein Abenteuer fortzusetzen.

PRO entdecken