Video in progress

Junior 🌿 Git

What is a remote? Where does `origin` come from?

A remote is a reference (a URL) to a repository somewhere else, given a short name. origin is the default name Git sets automatically when you run git clone, and it has no other special meaning.

📖 Answer

git remote -v
# origin  git@github.com:company/billing.git (fetch)
# origin  git@github.com:company/billing.git (push)

You can have several remotes. In open source the usual setup is: origin is your fork and upstream is the original project.

git remote add upstream git@github.com:spring-projects/spring-boot.git
git fetch upstream
git rebase upstream/main

Names like origin/main are remote-tracking branches. They live in your local copy and show the state of the server as of your last fetch. That is why, if you do not fetch, origin/main may be stale.