Skip to content
Versora

Manual

Stacks

Updating the stack from the server

5 min read

On this page

An ordinary pull only updates the current branch. In a stack, a teammate may have pushed commits to feature/b, or you yourself may have restacked on another machine, with a force push of all the branches. Update the stack from the server fetches and brings what changed into each branch of the stack, bottom to top. At the end, it rebuilds the stack on the updated main branch.

No local commit is lost. When both sides moved, your commits go on top of the server's. When the server was rewritten, its version is kept, with your unpushed commits on top.

Where to find it

  • STACKS section: down arrow button in the stack header (tooltip: "Update the stack from the server (fetch + pull of each branch)"). It appears when a branch of the stack is already on the remote.
  • Branch menu › Branch stack › Update the stack from the server.
  • Stack header: right-click › Update the stack from the server.
  • Palette (Ctrl+P): "Stack: update from the server" (detail: "Fetch, fast-forward or your commits on top of the server's, then restack onto the main branch").
  • In the notice of a push refused because the server has commits you haven't brought in: Update the stack from the server button (see Pushing the stack).

Step by step

  1. Open Update the stack from the server. The bar shows "Fetching…".
  2. If nothing changed on the server, you see "The stack feature/a already matches origin." If there's only something left to push, you see "Nothing new on the server for the stack feature/a; still to push: feature/c." with the Push the stack button.
  3. Otherwise, the Update the stack feature/a from the server? dialog opens with the plan (below).
  4. If a branch moved on both sides, choose what to do in When both local and server moved. Changing the choice redoes the plan and shows the new one first.
  5. Click Update the stack. The bar shows "Updating the stack from the server…".
  6. At the end: "The stack feature/a is up to date with the server." If a branch needs a push (your commits were reapplied on top, or there was a local rewrite), the notice has Push the stack.

The plan

The plan starts with "What comes from origin, bottom to top:". If the local main branch is also behind the server, the first line is about it: "main: fast-forward of 2 commits to origin/main".

Then comes one line per branch of the stack:

LineWhat happens
"feature/a: same as the server"Nothing.
"feature/a: only the local branch moved (still needs a push)"Nothing now; push later.
"feature/c: not on the server yet"Nothing now; push later.
"feature/a: deleted on the server (its merge request may have been merged)"The branch stays as it is. See Sync.
"feature/b: fast-forward, 2 new commits from the server"The branch moves forward to the server.
"feature/b: both sides moved; your commits go on top of the server's"Rebase of your commits onto the server's version.
"feature/b: the server was rewritten (restacked on another machine); the server's version is kept, with your unpushed commits on top"The server's version comes in, and your unpushed commits go on top.
"feature/b: the server was rewritten (restacked on another machine); the server's version is kept"The server's version comes in (you had no new commits).
"feature/b: the server moved and the local branch was rewritten; the server's version is kept"The server's version comes in.
"feature/b: only the local branch was rewritten, the server has nothing new (still needs a force push)"Nothing now; push later.
"feature/b: both sides moved; left as is (fast-forward only)"Nothing, because of the chosen mode.

After the line there may be marks in parentheses: "rebuilt on the updated parent" and "force push afterwards". Below each line, the commits involved (up to 8 per list, the rest becomes "… and N more commits"):

  • ↓ server commit coming in;
  • ↑ your unpushed commit, reapplied on top;
  • × your old, already pushed version that the server replaced (kept in the reflog and in Ctrl+Z).

The plan ends with:

  • "At the end, the stack sits on top of main.";
  • the branches that will need a force push: "Afterwards, feature/b will need a force push ("Push the stack", with --force-with-lease).";
  • the safety note: "No local commit is lost. A conflict stops in the conflict editor: Continue goes on and Abort leaves everything as it was, main included. Ctrl+Z undoes the whole update."
OptionWhat it doesDefault
When both local and server moved: Put my commits on top of the server's (rebase)Rebase of your commits onto the server's version.when the pull mode in Preferences isn't "fast-forward only"
When both local and server moved: Fast-forward only: leave those branches as they areUpdates only what fast-forward allows; the rest stays.when the pull mode is "fast-forward only"

The choice only appears when a branch moved on both sides.

Tip

If your pull mode is "fast-forward if possible" (merge), the plan warns: "Pull is set to merge in Preferences; in a stack your commits go on top of the server's (rebase), because a merge inside a stacked branch would keep the stack from being updated later."

What Versora does in git

  1. git fetch --all --prune --tags.
  2. The local main branch moves forward to the server, if it's a fast-forward.
  3. Each branch of the stack gets what the plan showed, and the stack is rebuilt on the main branch, all in the same single rebase as the restack.
  4. When the server's version came into a branch that was also rebuilt, Versora records in the reflog that it was integrated. That way the next force push, with the check equivalent to --force-if-includes, isn't refused for no reason.

How to undo

Ctrl+Z undoes "Update stack feature/a from server": all the branches, including the main one, go back to what they were. The fetch isn't undone (the remote branches stay updated).

Caveats and messages

  • "A merge, rebase or cherry-pick is stopped halfway: finish or abort it before changing the stack."
  • "feature/b isn't part of a stack.": open the action from a branch of the stack.
  • Conflict: "The operation stopped on a conflict in feature/b (a1b2c3d). Resolve it in the conflict editor and click Continue to go on, or Abort to leave everything as it was."
  • "feature/b is in use in the worktree …: update the stack from there or close that worktree.": a stack branch checked out in another worktree prevents the update. The main branch in use in another worktree doesn't move forward from here either.
  • Preferences › General › Default pull mode sets the plan's initial mode.
  • The fetch credentials come from Git servers or from git's credential helper.

See also