Stacks
Getting a teammate's stack
6 min read
To review or continue someone else's stack, you need their branches on your machine, each one tracking the server and recorded on top of the one below. Get the stack does all of that from a merge request in the stack: it brings all the branches, shows beforehand what will happen to each one and does the checkout.
A local branch with commits the server doesn't have is never overwritten. You choose to keep yours or rename it and create the server's.
The stack is the chain of open merge requests that goes through the chosen one:
- on GitLab, through the targets:
!11targets the source branch of!10, which targetsmain; - on GitHub, through the stack GitHub itself reports, when there is one; otherwise, through the targets.
If the merge request isn't in a chain, you see "!11 isn't in a stack: no merge request targets its branch, and it doesn't target another one's branch." with the Check out button, which does the ordinary checkout of the merge request's branch.
- MERGE REQUESTS section: click the Stack 2/3 chip on the merge request row › Get the stack of !11…
- MERGE REQUESTS section: right-click the row › Get the stack of !11…
- Merge request review: Get the stack button in the stack navigation (tooltip: "Fetches this stack's branches from the server and builds the local stack (Ctrl+Z undoes it).").
- MR inbox: the item's menu › Get the stack of !11… (when the project is already on Home; Versora opens its tab first).
- Menu of a branch in the local stack › Branch stack › Get the stack from the server (from !11)…
- Palette (Ctrl+P): "Get the stack of a merge request…" (detail: "Fetches the branches of a merge request's stack (yours or a teammate's) and builds the local stack"). It opens the Get the stack picker: "Pick a merge request in the stack:". With none, you see "No open merge request is in a stack.".
- Choose Get the stack of !11… in one of the places above.
- The bar shows "Fetching the stack from origin…".
- The Get the stack of !11 (3 merge requests) dialog opens: "The fetch brought the stack's branches. Check what happens to each one: a local branch with commits the server doesn't have is never overwritten."
- Check the list, bottom to top. Each item shows the number, the local branch and the parent
(
!11 feature/b → feature/a) and what will happen (table below). - For the branches you already have with commits of your own, choose Keep mine (don't update) or Rename mine and create the server's and the new name.
- In Check out at the end, choose the branch you'll end up on. The one from the merge request you started from comes selected; (don't check out) leaves you where you are.
- Click Get the stack. The bar shows "Getting the stack (3 branches)…".
- The notice sums it up: "Stack fetched (3 branches).", "Created: …", "Updated (fast-forward): …", "Your feature/c is now called feature/c-local.", "Kept as they were (they have commits the server doesn't): …" and "Checked out feature/b.".
| Text in the dialog | What happens |
|---|---|
| "Create feature/a tracking origin/feature/a." | The local branch is created, with an upstream. |
| "Create feature/a (no upstream)." | The branch is created without an upstream (for example, from a fork). |
| "feature/a already matches the server." | Nothing changes. |
| "Update feature/b to the server (fast-forward: +2)." | The local branch moves forward. |
| "feature/c already exists here with commits the server doesn't have (+1): it isn't overwritten." | You choose to keep or rename. |
| "feature/c already exists here and diverged from the server (2 commits only here, 3 only there): it isn't overwritten." | You choose to keep or rename. |
| "feature/b is behind the server but checked out in the worktree …: it stays as is." | Update it from there. |
Notes that may appear along with them:
- "The branch no longer exists on the server: the commits come from the merge request ref.";
- "Comes from a fork: the branch has no upstream (a push wouldn't go to the fork)." (with the fork chip).
With uncommitted changes, the dialog warns: "There are uncommitted changes: the checkout carries them along (or is refused if they conflict)." And it reminds you: "The stack is recorded (each branch with its parent), with the bottom one on main. Ctrl+Z removes the created branches and restores the updated ones."
| Option | What it does | Default |
|---|---|---|
| Keep mine (don't update) | The local branch stays as it is, and the server's isn't brought into it. | selected |
| Rename mine and create the server's | Your branch gets the typed name, and the original name becomes the server's branch. The suggested name is feature/c-local. | — |
| Check out at the end | The branch you end up on. | the one from the starting merge request |
# a single fetch: the bottom one's target and the source branch of each merge request
git fetch --no-tags --no-write-fetch-head origin \
+refs/heads/main:refs/remotes/origin/main \
+refs/heads/feature/a:refs/remotes/origin/feature/a \
+refs/heads/feature/b:refs/remotes/origin/feature/b
# merge request from a fork, or with the branch already deleted on the server: the merge request ref
git fetch --no-tags --no-write-fetch-head origin +refs/merge-requests/12/head:refs/versora/fork/12 # GitLab
git fetch --no-tags --no-write-fetch-head origin +refs/pull/12/head:refs/versora/fork/12 # GitHub
# for each branch: create and track, fast-forward, rename or nothing
git branch --set-upstream-to=origin/feature/b feature/b
# and record the stack
git config branch.feature/b.versora-parent feature/a
If fetching everything together fails, Versora tries one ref at a time. A branch that disappeared
from the server comes through the merge request ref. The refs/versora/fork/* refs don't appear as
branches and aren't pushed. A merge request from a fork becomes a local branch with a name like
mr-12-feature/x (pr-12-… on GitHub).
Before touching any branch, Versora checks everything again: an error midway would leave the stack half done.
Ctrl+Z undoes "Get stack (3 branches)": the created branches are removed, the updated ones go back to what they were, and a renamed one gets its old name back. The remote branches brought by the fetch stay.
- "This repository has no GitLab/GitHub set up (or the token is missing in Git servers).": register the server in Git servers.
- "Two merge requests in the stack would use the same local branch (feature/b).": two merge requests in the chain come from branches with the same name (from different forks, for example).
- "feature/b changed after the check. Open "Get the stack" again.": a local branch changed between the dialog and the run.
- "A branch named feature/c-local already exists.": choose another name to rename it to.
- "The branches are ready, but checking out feature/b failed: …": the stack was built, but the final checkout didn't work (usually because of conflicting local changes). Do the checkout by hand.
- "Couldn't fetch … from origin: …": the fetch failed. Check the network and the credential.
Tip
After getting the stack, you can review each merge request in the app, continue the work on the upper branch and use Update the stack from the server to bring in what your teammate pushes later.
There's no preference of its own. The fetch uses the credentials from Git servers and respects
allowed_servers from the company policy.