3.6 KiB
3.6 KiB
Git-Workflow: Remotes, Branches, Merges
Letzte Aktualisierung: 2026-06-23
Dieses Projekt hat zwei Git-Remotes mit unterschiedlichen Rollen:
| Remote | URL | Zweck |
|---|---|---|
github |
https://github.com/theurj/breadcrumb-the-shire.git |
CI/CD (GitHub Actions) — hier wird deployed |
origin |
https://onion.breadcrumb-online.de/fa/... |
Gitea — internes Repo, Pull Requests von Kollegen |
Alle Deployments laufen über github. Auf origin (Gitea) wird nicht automatisch gepusht.
Remotes anzeigen
git remote -v
Ausgabe:
github https://github.com/theurj/breadcrumb-the-shire.git (fetch)
github https://github.com/theurj/breadcrumb-the-shire.git (push)
origin https://fa:TOKEN@onion.breadcrumb-online.de/fa/breadcrumb-the-shire.git (fetch)
origin https://fa:TOKEN@onion.breadcrumb-online.de/fa/breadcrumb-the-shire.git (push)
Änderungen auf GitHub deployen
git push github main
Löst GitHub Actions aus (CI + Deploy). Niemals git push ohne github — sonst landet es nur in Gitea.
Pull Request eines Kollegen aus Gitea übernehmen
1. Offene PRs in Gitea anzeigen
curl -s "https://fa:TOKEN@onion.breadcrumb-online.de/api/v1/repos/fa/breadcrumb-the-shire/pulls?state=open" \
| python -c "import sys,json; [print(f'PR #{p[\"number\"]}: {p[\"title\"]} | branch: {p[\"head\"][\"label\"]} | by: {p[\"user\"][\"login\"]}') for p in json.load(sys.stdin)]"
2. Fork des Kollegen als Remote hinzufügen
git remote add tbh "https://fa:TOKEN@onion.breadcrumb-online.de/tbh/breadcrumb-the-shire.git"
Den Remote-Namen (tbh) einmalig hinzufügen — bei weiteren PRs desselben Kollegen entfällt dieser Schritt.
3. Branch holen und Commits prüfen
git fetch tbh feature/security-checks
git log tbh/feature/security-checks --oneline --not origin/main
4. Geänderte Dateien im Überblick
git diff origin/main...tbh/feature/security-checks --stat
5. Branch in main mergen
git merge tbh/feature/security-checks --no-ff -m "feat(security): merge security checks module"
--no-ff erzwingt einen Merge-Commit, damit der Branch-Ursprung im Log sichtbar bleibt.
6. Auf GitHub pushen
git push github main
Eigene Änderungen committen und pushen
# Bestimmte Dateien stagen (nie git add -A, könnte .env miterfassen)
git add modules/helpdesk/pages/helpdesk/handovers/_form.phtml
# Committen
git commit -m "fix(helpdesk): describe what and why"
# Deployen
git push github main
Status und Log
# Aktueller Zustand (geänderte / ungetrackte Dateien)
git status
# Letzte Commits
git log --oneline -10
# Alle Branches (lokal + remote)
git branch -a
# Änderungen zwischen lokalem main und GitHub
git diff github/main...main --stat
Neuen Kollegen-Fork als Remote hinzufügen
git remote add <name> "https://fa:TOKEN@onion.breadcrumb-online.de/<username>/breadcrumb-the-shire.git"
Beispiel für Benutzer mia:
git remote add mia "https://fa:TOKEN@onion.breadcrumb-online.de/mia/breadcrumb-the-shire.git"
git fetch mia feature/my-feature
git merge mia/feature/my-feature --no-ff -m "feat(...): merge ..."
git push github main
Wichtige Regeln
- Niemals
git pushohne Remote-Angabe — Standard-Remote istorigin(Gitea), nichtgithub. - Niemals
git add .odergit add -A— immer Dateien explizit benennen (verhindert, dass.envoderdb_export.sqlcommittet wird). - Jede Änderung sofort committen, nicht sammeln.
db_export.sqlist gitignored (oder sollte es sein) — nicht committen.