What is the difference between origin and upstream when working with multiple remotes, and how is this used in a forking workflow?
Last updated
Both are just conventional remote names:
originis the repo you cloned (in a fork workflow, your own fork that you can push to).upstreamis a remote you add manually for the original project. You fetch from it to stay current but usually cannot push to it.Fork workflow: clone your fork, run
git remote add upstream <url>, sync viagit fetch upstream, push toorigin, then open a PR against upstream.
- https://apxml.com/courses/getting-started-with-git/chapter-5-working-with-remote-repositories/git-origin-upstream
- https://community.latenode.com/t/understanding-the-distinction-between-origin-and-upstream-remotes-in-git-repositories/31469
- https://dev.to/untilyou58/keep-your-fork-in-sync-understanding-git-remote-upstream-366l
- https://docs.github.com/en/pull-requests/how-tos/work-with-forks/configuring-a-remote-repository-for-a-fork
- https://docs.github.com/articles/syncing-a-fork
- https://medium.com/@nynptel/difference-between-origin-and-upstream-for-a-git-repository-67e0a7f1a90e