Hone

Lessons · Git · the other end, by name

Named places to sync with

A remote is a name for another copy of the repository, with a URL. origin is the conventional name for where you cloned from; you can add others.

Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.

What it is for

Working on a fork means two remotes: origin (your fork) and upstream (the original), so you can pull the project's changes and push your own.

How to think about it

git remote -v to see what you have. add a second one when you need to talk to another copy. Remember that a remote is a bookmark; the branches that matter are origin/main and friends.

Worked example

git remote -v
The named copies you talk to; origin is where you cloned from.
git remote add upstream https://example.com/original/app.git
A second remote: the original project, when you work on a fork.
git remote -v
origin and upstream, each with fetch and push URLs.

Your turn

Register the original project as a second remote.

git remote  upstream https://example.com/original/app.git

The trap

origin is a name, not a rule. Rename it or add others; what matters is which remote each branch tracks.

Practise the other end, by name on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.