Branches and remotes
Upstream (the remote branch a branch tracks)
3 min read
The upstream is the remote branch a local branch tracks. It's what pull uses as the source, the
regular push uses as the destination and the ↑/↓ counters use for comparison. Usually main tracks
origin/main and feature/login tracks origin/feature/login.
Versora sets the upstream on its own in most cases: on the first push of a new branch (Publish branch) and when checking out a remote branch that didn't exist locally yet. This page shows how to see it and adjust it by hand.
In the LOCAL section, each branch with an upstream shows:
- ↑N: commits the local branch has and the remote doesn't (tooltip: "2 commits ahead of origin/main");
- ↓N: commits the remote has and the local branch doesn't (tooltip: "3 commits behind origin/main");
- the row's tooltip:
main → origin/main.
The badges on the bar's Push (↑) and Pull (↓) buttons show the same numbers for the current branch. The numbers are based on the last fetch (see Fetch).
The gone badge (tooltip: "The tracked remote branch no longer exists") shows up when the branch tracked a remote branch that was deleted on the server, for example after merging a merge request with "delete source branch". In that state, the regular push publishes the branch again (the Publish branch dialog). To clean up branches in that situation in bulk, see Hygiene and flow.
- A local branch's menu: Set upstream… (on the current branch and the others).
- In a commit's menu, each local branch's submenu also has the item.
- Choose Set upstream… on the
feature/loginbranch. - The Set upstream of feature/login dialog explains: "The remote branch this branch tracks for pull and push."
- In Remote branch, choose one of the remote branches on the list. The current upstream comes suggested or, if there's none, the remote branch with the same name.
- To remove the upstream, choose (none — remove upstream).
- Click Set.
git branch --set-upstream-to=origin/feature/login feature/login
git branch --unset-upstream feature/login # (none — remove upstream)
Only the branch's configuration changes (branch.feature/login.remote and
branch.feature/login.merge in .git/config). No commit is sent or downloaded.
Setting or removing the upstream isn't added to the undo history: only the branch's configuration changes, and Versora's Ctrl+Z tracks branches, tags, HEAD and stashes. A Ctrl+Z right after undoes the previous operation, if there is one: the one the undo button's tooltip shows ("Undo: ‹operation› (Ctrl+Z)"). To put the upstream back, open Set upstream… again and choose the previous remote branch.
- "There are no remote branches yet. Use Push to publish this branch and set its upstream.": the repository doesn't have any remote branch yet (there was never a fetch or push). Publish the branch with Push.
- After renaming a branch, the upstream still points to the remote branch with the old name. Adjust it here, if you want.
- A branch with an upstream of another name (for example,
feature/logintrackingorigin/feature/login-v2) is sent to that name when you push a branch that isn't checked out.
- There's no preference of its own. Automatic fetch keeps the counters up to date (Preferences › General › Remotes).