Übertragung per Push an Remotes

Git für Fortgeschrittene

George Boorman

Curriculum Manager, DataCamp

Daten per Pull aus einem Remote ziehen

Pull von einem Remote-Repository

Git für Fortgeschrittene

Übertragung per Push an Remote

Per Push an Remote übertragen

Git für Fortgeschrittene

git push

  • Speichere die Änderungen zuerst lokal!
git push remote local_branch
  • Übertragung per Push nach remote aus local_branch

  • Änderungen werden per Push vom Branch main des lokalen Repos nach origin übertragen

git push origin main
Git für Fortgeschrittene

Push-/Pull-Workflow

Inhalte vom Remote ins lokale Repo ziehen

Git für Fortgeschrittene

Push-/Pull-Workflow

Lokale Arbeit am Projekt

Git für Fortgeschrittene

Push-/Pull-Workflow

Aktualisiertes lokales Repository auf das Remote übertragen

Git für Fortgeschrittene

Zuerst Push

  • Vor Pull wird main per Push auf Remote übertragen
git push origin main
Git für Fortgeschrittene

Lokale/Remote-Konflikte

Ausgabe für git push origin main abgelehnt

Git für Fortgeschrittene

Lokale/Remote-Konflikte

Ausgabe für git push origin main abgelehnt mit Remote-URL im Kommentar

Git für Fortgeschrittene

Lokale/Remote-Konflikte

Ausgabe für git push origin main abgelehnt mit kommentiertem Ergebnis

Git für Fortgeschrittene

Lokale/Remote-Konflikte

Ausgabe für git push origin main abgelehnt mit Gründen und Vorschlägen im Kommentar

Git für Fortgeschrittene

Konflikte vermeiden

  • Zuerst per Pull aus dem Remote ziehen
git pull origin main

git_pull_nano_editor.gif

Git für Fortgeschrittene

Pull-Befehl ohne Angaben

git pull --no-edit origin main
  • Nicht empfehlenswert, es sei denn, wir sind uns des Verlaufs unseres Projektes sehr sicher!
Git für Fortgeschrittene

Neuen lokalen Branch per Push übertragen

  • Arbeit im lokalen Branch hotfix

  • hotfix existiert nicht im Remote

Git für Fortgeschrittene

Neuen Remote-Branch erstellen

  • hotfix nur lokal vorhanden
git push origin hotfix
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 349 bytes | 349.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: 
remote: Create a pull request for 'hotfix' on GitHub by visiting:
remote:      https://github.com/datacamp/project/pull/new/hotfix
remote: 
To https://github.com/datacamp/project
 * [new branch]      hotfix -> hotfix
branch 'hotfix' set up to track 'origin/hotfix'.
Git für Fortgeschrittene

Lass uns üben!

Git für Fortgeschrittene

Preparing Video For Download...