1.8 KiB
1.8 KiB
✅ Lösung – Aufgabe 02: Erste Schritte
Schau dir diese Lösung erst an, nachdem du die Aufgabe selbst versucht hast!
Schritt-für-Schritt-Lösung
1. Ordner anlegen und initialisieren
mkdir meine-notizen
cd meine-notizen
git init
Initialized empty Git repository in /pfad/zu/meine-notizen/.git/
2. Datei anlegen – Commit 1
Erstelle notizen.md und füge die erste Zeile ein:
echo "Git ist ein Versionskontrollsystem." > notizen.md
git add notizen.md
git commit -m "docs: Erste Notiz – Was ist Git?"
[main (root-commit) a1b2c3d] docs: Erste Notiz – Was ist Git?
1 file changed, 1 insertion(+)
create mode 100644 notizen.md
3. Zweite Zeile – Commit 2
Öffne notizen.md und füge Zeile 2 hinzu. Dann:
git add notizen.md
git commit -m "docs: Zweite Notiz – Was sind Commits?"
[main e4f5g6h] docs: Zweite Notiz – Was sind Commits?
1 file changed, 1 insertion(+)
4. Dritte Zeile – Commit 3
Öffne notizen.md und füge Zeile 3 hinzu. Dann:
git add notizen.md
git commit -m "docs: Dritte Notiz – Was ist die Staging Area?"
[main i7j8k9l] docs: Dritte Notiz – Was ist die Staging Area?
1 file changed, 1 insertion(+)
5. Erwartete Log-Ausgabe
git log --oneline
i7j8k9l (HEAD -> main) docs: Dritte Notiz – Was ist die Staging Area?
e4f5g6h docs: Zweite Notiz – Was sind Commits?
a1b2c3d docs: Erste Notiz – Was ist Git?
6. Abschlussprüfung
git status
On branch main
nothing to commit, working tree clean
Fertiger Inhalt von notizen.md
Git ist ein Versionskontrollsystem.
Commits sind Snapshots meines Projekts.
Die Staging Area bereitet Commits vor.
Zurück zur Aufgabe