|
| 1 | +#!/usr/bin/env bash |
| 2 | +# DVC-E1 — Git-Workflow zum manuellen Durcharbeiten. |
| 3 | +# Zeile fuer Zeile ausfuehren, dabei die ausgegebenen Commit-Hashes |
| 4 | +# in die README eintragen. |
| 5 | + |
| 6 | +set -e |
| 7 | + |
| 8 | +# ---------- 1) Init & Initial-Push ---------- |
| 9 | +git init |
| 10 | +git branch -M main |
| 11 | +echo "# SWT — DVC-E1" > README.md # spaeter durch finale README ersetzen |
| 12 | +git add README.md notes.md |
| 13 | +git commit -m "chore: initial commit" |
| 14 | +git remote add origin git@github.com:RDBHT/SWT.git |
| 15 | +git push -u origin main |
| 16 | + |
| 17 | +# ---------- 2) status / diff / commit ---------- |
| 18 | +echo "weitere Zeile" >> notes.md |
| 19 | +git status |
| 20 | +git diff |
| 21 | +git add notes.md |
| 22 | +git commit -m "docs: extend notes" |
| 23 | +git push |
| 24 | + |
| 25 | +# ---------- 3) mv / rm ---------- |
| 26 | +git mv notes.md notizen.md |
| 27 | +git commit -m "refactor: rename notes -> notizen" |
| 28 | + |
| 29 | +echo "tmp" > tmp.txt |
| 30 | +git add tmp.txt |
| 31 | +git commit -m "chore: add tmp file" |
| 32 | +git rm tmp.txt |
| 33 | +git commit -m "chore: remove tmp file" |
| 34 | +git push |
| 35 | + |
| 36 | +# ---------- 4) Zeitreisen ---------- |
| 37 | +git log --oneline |
| 38 | +# Rueckkehr in alten Zustand (detached HEAD), dann zurueck: |
| 39 | +INIT_HASH=$(git rev-list --max-parents=0 HEAD) |
| 40 | +git checkout "$INIT_HASH" |
| 41 | +git checkout main |
| 42 | + |
| 43 | +# Revert demonstrieren: |
| 44 | +git revert --no-edit HEAD |
| 45 | +git push |
| 46 | + |
| 47 | +# ---------- 5) Branches ---------- |
| 48 | +git checkout -b feature/a |
| 49 | +echo "A" >> notizen.md |
| 50 | +git commit -am "feat(a): add A" |
| 51 | +git push -u origin feature/a |
| 52 | + |
| 53 | +git checkout main |
| 54 | +git checkout -b feature/b |
| 55 | +echo "B" >> notizen.md |
| 56 | +git commit -am "feat(b): add B" |
| 57 | +git push -u origin feature/b |
| 58 | + |
| 59 | +git checkout main |
| 60 | +git merge --no-ff feature/a -m "merge: feature/a" |
| 61 | +git merge --no-ff feature/b -m "merge: feature/b" # ggf. Konflikt loesen |
| 62 | +git push |
| 63 | + |
| 64 | +# ---------- 6) Pull-Request auf edlich/education ---------- |
| 65 | +# Manuell via GitHub-Web-UI: |
| 66 | +# 1. https://github.com/edlich/education forken |
| 67 | +# 2. Im Fork: eine bestehende Datei im student/-Verzeichnis minimal editieren |
| 68 | +# 3. PR erstellen, PR-Nummer + Link in README eintragen |
| 69 | + |
| 70 | +# ---------- Pull / log am Ende ---------- |
| 71 | +git pull --rebase |
| 72 | +git log --oneline --graph --all |
0 commit comments