101 lines
1.8 KiB
Markdown
101 lines
1.8 KiB
Markdown
# ✅ 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
|
||
|
||
```bash
|
||
mkdir meine-notizen
|
||
cd meine-notizen
|
||
git init
|
||
```
|
||
|
||
```text
|
||
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:
|
||
|
||
```bash
|
||
echo "Git ist ein Versionskontrollsystem." > notizen.md
|
||
git add notizen.md
|
||
git commit -m "docs: Erste Notiz – Was ist Git?"
|
||
```
|
||
|
||
```text
|
||
[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:
|
||
|
||
```bash
|
||
git add notizen.md
|
||
git commit -m "docs: Zweite Notiz – Was sind Commits?"
|
||
```
|
||
|
||
```text
|
||
[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:
|
||
|
||
```bash
|
||
git add notizen.md
|
||
git commit -m "docs: Dritte Notiz – Was ist die Staging Area?"
|
||
```
|
||
|
||
```text
|
||
[main i7j8k9l] docs: Dritte Notiz – Was ist die Staging Area?
|
||
1 file changed, 1 insertion(+)
|
||
```
|
||
|
||
### 5. Erwartete Log-Ausgabe
|
||
|
||
```bash
|
||
git log --oneline
|
||
```
|
||
|
||
```text
|
||
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
|
||
|
||
```bash
|
||
git status
|
||
```
|
||
|
||
```text
|
||
On branch main
|
||
nothing to commit, working tree clean
|
||
```
|
||
|
||
---
|
||
|
||
## Fertiger Inhalt von notizen.md
|
||
|
||
```text
|
||
Git ist ein Versionskontrollsystem.
|
||
Commits sind Snapshots meines Projekts.
|
||
Die Staging Area bereitet Commits vor.
|
||
```
|
||
|
||
---
|
||
|
||
*Zurück zur [Aufgabe](../02-erste-schritte/aufgabe.md)*
|