On this page

Work contexts and worktrees

You are halfway through a fix when a review arrives. A work context helps you return to the same view and draft. A worktree gives the other task its own files and staging area. Choose according to what needs to stay separate.

Choose how to switch tasks

Need Use
Return to a tab's selection, filters, scroll position and commit draft during this session Close and resume its context.
Work on another revision while keeping the original checkout untouched Create a worktree in a separate folder.
Set edits aside temporarily in the same checkout Save a named stash, then restore it deliberately. See the safety net.

Close and resume a context

Open Work contexts to see open repositories, recently closed contexts and discovered worktrees. Check the branch, associated pull request, pending changes and commit draft. If inspection is unavailable or incomplete, open the repository and check it before acting.

Select an open context and choose Close context. Read the confirmation, especially if Git has an operation in progress. Closing preserves the repository, branch and files on disk. It does not finish or abort a merge, rebase or other Git operation, and it does not create or apply a stash.

Choose Resume context to return to the available tab state. Riff retains up to ten recent closed contexts in memory in the current workspace. Their selection, filters, scrolling and drafts are session state: restarting Riff or changing workspace does not preserve this cache. This is separate from the saved tab order and workspace synchronization.

Create a separate worktree

  1. Select a repository in Work contexts and choose New worktree.
  2. Choose an empty or new destination folder outside the Git metadata directory. Select the starting revision and, when needed, a new branch name that follows your team's rules.
  3. Review the choices and create the worktree. Without a new branch, it opens at a detached HEAD. Create a branch before making commits you intend to keep.
  4. Open the resulting folder in Riff. It has its own files and index, while sharing the repository's Git history. Your plan or guest repository limit may prevent opening an additional tracked repository even if Git created the worktree successfully; check the result before repeating creation.

For a pull request, use Open in worktree from the review to prepare the exact reviewed commit. Switching contexts does not publish commits or change the original checkout.

Remove a worktree when finished

Commit or save work you need before choosing Remove for the additional worktree. Riff refuses removal when it finds pending changes, ignored files, an operation in progress, a locked worktree or the main working tree. Inspect ignored build output and other files before deciding what to remove.

If HEAD is detached, preserve the commit with a local branch or tag first. Removal does not automatically delete the branch or push your commits. Closing a context only hides its tab; removing a worktree removes its working folder. Keep that distinction when finishing a task.