Summary: Remotes and forks
The one-sentence definition
Section titled “The one-sentence definition”A remote is a named pointer to another git repository’s URL. Branches travel between machines via push and pull through remotes.
The essential commands
Section titled “The essential commands”git clone <url> # get a full copy of a remote repogit remote -v # see your remotesgit remote add upstream <url> # add a second remotegit fetch # download remote changes without merginggit pull --rebase # fetch + rebase (no merge commit)git push # send your commits upgit push -u origin <branch> # first push of a new branch (sets tracking)git push --force-with-lease # safe force-push for personal branchesDistributed model means
Section titled “Distributed model means”- Every clone is a full repo
- Local operations work offline
- GitHub outage doesn’t lose data; only blocks push/pull
- Recovery is possible from any clone
Pull-rebase is the modern default
Section titled “Pull-rebase is the modern default”git config --global pull.rebase trueSet this once. Stops the merge-commit clutter on every pull.
The fork-based model
Section titled “The fork-based model”| Pointer | Points to |
|---|---|
origin | Your fork |
upstream | The original project |
Push to origin. Open PR from origin to upstream. Sync origin/main from upstream/main to stay current.
Force-push discipline
Section titled “Force-push discipline”- Yes:
--force-with-leaseon your own personal branches (after rebase) - No:
--force(plain) on anything; too dangerous - No: any force-push on
main,develop, or release branches
Remote-tracking branches
Section titled “Remote-tracking branches”origin/main, origin/feature-x are read-only labels for “what the remote looked like at last fetch.” git status tells you ahead / behind / diverged.
Phase 2 closed
Section titled “Phase 2 closed”You have:
- Branches (L5)
- PRs (L6)
- Conflicts (L7)
- Remotes (L8)
That is confident two-person collaboration. Phase 3 covers production team workflows.
What you carry into Phase 3
Section titled “What you carry into Phase 3”The push/pull/remote skills are the foundation for every team workflow Phase 3 introduces. GitHub Flow, GitFlow, Trunk-based are all conventions BUILT on remotes and branches. You have the primitives; Phase 3 teaches the patterns that wrap them.
Voice anchor
Section titled “Voice anchor”Git stores snapshots. Every other command is just navigating those snapshots.
Push and pull are navigating snapshots between machines.