CodeAgeBy Sitezack
Git & CLI für Profis ⌨️Git auf der Kommandozeile meistern0 XP
Kapitel-Fortschritt0/5

Lektion 4 von 5

Remote, push und pull

Ein entferntes Repository (Remote, oft origin) hostet eine geteilte Kopie. git push sendet deine lokalen Commits zum Remote.

git pull holt die Commits vom Remote, die du noch nicht hast. Wir modellieren jedes Repository als Liste von Commits.

# git push -> fuer jeden ueberzaehligen lokalen Commit: remote.append(c)
# git pull -> fuer jeden ueberzaehligen Remote-Commit: local.append(c)

🎯 Aufgabe

local hat drei Commits, remote nur einen. 1) git push: füge zu remote die Commits von local hinzu, die ihm fehlen (local[len(remote):]). 2) Ein Kollege pusht einen Commit: remote.append("c4"). 3) git pull: füge zu local die Commits von remote hinzu, die ihm fehlen (remote[len(local):]). Gib len(local) aus.

PRO-Lektion

Dieses fortgeschrittene Kapitel gehört zu CodeAge PRO. Schalte es frei, um dein Abenteuer fortzusetzen.

PRO entdecken