CodeAgeBy Sitezack
Git & CLI for Pros ⌨️Master Git on the command line0 XP
Chapter progress0/5

Lesson 4 of 5

Remote, push and pull

A remote repository (remote, often origin) hosts a shared copy. git push sends your local commits to the remote.

git pull fetches the commits from the remote you don't have yet. We model each repository as a list of commits.

# git push -> for each extra local commit: remote.append(c)
# git pull -> for each extra remote commit: local.append(c)

🎯 Exercise

local has three commits, remote only one. 1) git push: append to remote the commits from local it is missing (local[len(remote):]). 2) A teammate pushes a commit: remote.append("c4"). 3) git pull: append to local the commits from remote it is missing (remote[len(local):]). Print len(local).

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO