upstream branch
The remote branch your local branch is linked to, which git push, git pull and git status use when you do not name one.
In more detail
git clone sets it for the first branch, and git push -u origin feature sets it when you publish a new branch. After that, plain git push and git pull know where to go, and git status reports how many commits you are ahead or behind. The word upstream is also used for the original repository in a fork workflow.
Example
git push -u origin feature/42-new-buttonRelated terms
- remote-tracking branch — A local, read-only record of where a branch on a remote pointed the last time you talked to it, such as origin/main.
- git push — The command that uploads your commits to a remote and moves the remote's branch to match.
- git pull — The command that fetches from the upstream remote and then merges (or, if configured, rebases) the new commits into your current branch.
- fork — A copy of someone else's repository made on a hosting service such as GitHub, under your own account, so you can push to it.
Taught in
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- Fetch Is Not Pull — Advanced Git Internals & Distributed Workflows
- The Pull Request, And Branch Naming — Advanced Git Internals & Distributed Workflows