Skip to main content

StGit Layers

A Textual browser for StGit repositories. It displays the patch stack, staged changes, and unstaged changes as expandable file/hunk trees, with a preview for the selected node. Files and individual text hunks in the staged and unstaged sections can be staged or unstaged from the tree.

Requirements

  • Python 3.15 or newer
  • Git
  • StGit (stg)

Install and run

Install the tool from a checkout with uv:

uv tool install .
cd /path/to/stgit-repository
stg-layers

The default tree order shows Unstaged changes, Staged changes, then Patch stack, with patches newest to oldest. Press Shift+R to reverse the order: patches oldest to newest, then staged and unstaged changes. The patch stack expands to patches > files > hunks; the staged and unstaged sections expand to files > hunks. On startup, sections and patches are expanded to show their files, while each file's hunks are collapsed. Non-ignored untracked files appear as additions in Unstaged changes.

Use Up/Down to move between visible nodes. Right expands a node or moves to its first child; Left collapses a node or moves to its parent. The preview updates as the highlighted node changes. Press Tab to move focus between the tree and read-only diff preview. The preview scrolls independently with Page Up/Page Down or the mouse wheel. Horizontal overflow is clipped in the tree to keep its scrollbar out of view.

With the tree focused, Enter stages the selected file or hunk under Unstaged changes, and unstages the selected file or hunk under Staged changes. After Enter, selection advances to the next file or hunk in the source group, making repeated presses useful for staging or unstaging a series of changes. Ctrl+Down also stages an unstaged file or hunk; on a staged file it moves that file's staged contents into the current patch. Ctrl+Up unstages a staged file or hunk; on a current-patch file it spills that file into Staged changes. With the Ctrl shortcuts, selection follows the moved file or hunk. The preview refreshes after all these operations, and expanded file state is retained. Hunk actions preserve other hunks in the same file. File actions include untracked files. Enter and the staged / unstaged shortcuts update Git's index but leave working-tree contents and the patch stack unchanged. Patch-stack nodes are not modified by Enter. Press c while the tree is focused to edit StGit's new-patch message template; select Create to add an empty patch on top of the applied stack, or Cancel/Escape to leave the stack unchanged. Press e on a patch node to edit that patch's StGit-generated message template. Create applies the edited message to the selected patch; cancelling leaves it unchanged. Moving a staged file into the current patch temporarily preserves other staged files and leaves unstaged changes in the working tree. Spilling a current-patch file temporarily preserves other staged files; if the selected file already has staged changes, unstage those first. Hunk-level moves between the staged and unstaged sections are supported, but patch moves remain file-level. Files in other patches are not moved by these shortcuts. In the reversed tree order, the Ctrl+Up and Ctrl+Down actions swap to follow the displayed direction: Ctrl+Up stages or moves toward the patch stack, while Ctrl+Down spills or unstages toward Unstaged changes. Press r to refresh repository state and q to quit.

On a patch node, Ctrl+Up moves it one position toward newer patches and Ctrl+Down moves it one position toward older patches; these actions swap in reversed order to continue following the displayed direction. At the top or bottom, the action does nothing. Patches cannot be moved across the applied / unapplied boundary. Before reordering, StGit Layers stashes staged, unstaged, and untracked changes, then restores them with their staged state after the operation. The stash is removed only after restoration succeeds. If reordering or restoring the changes causes a conflict, choose Undo to run stg undo --hard, restore the prior stack, and retry restoring the stash; Quit to resolve it in the terminal (the stash is retained); or Refresh after resolving it there. If a stash-restore conflict is resolved manually, the stash is retained as a backup. When the repository already has unresolved index conflicts, StGit Layers is locked behind a Refresh/Quit dialog until they are resolved.

On an unapplied patch node, press p to run stg push <patch>. On an applied or current patch node, press Shift+P to run stg pop <patch>. StGit applies or unapplies the selected patch and may reorder patches as needed. Staged, unstaged, and untracked changes are stashed and restored with the staged state preserved. If pushing, popping, or restoring the changes causes a conflict, the same Undo/Quit/Refresh recovery applies.

Diff previews are shown as plain text. Preview line numbers are omitted because they are not source-file line numbers. Tree labels use bold section headings and distinct colors for patch statuses, patch names, file paths, and file statuses. Patch labels display as [status patch-id] title, with the status marker and patch ID sharing the status color: >, +, -, and ~.

Development

uv sync --dev
uv run pytest
uv run ty check
uv run ruff check

Metadata

Release files for stg-layers 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stg-layers 0.1.0
File Size Uploaded Provenance Actions
stg_layers-0.1.0.tar.gz 17.2 kB Without provenance Details for stg_layers-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stg-layers 0.1.0
File Interpreter ABI Platform Actions
stg_layers-0.1.0-py3-none-any.whl Python 3 none any Details for stg_layers-0.1.0-py3-none-any.whl

Total release size: 35.7 kB

Release files / stg_layers-0.1.0.tar.gz

Download URL stg_layers-0.1.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a05cf3bf89a78b8eb0386b87dc6480b2c1c58c90e672ae635f9782d0a09b7db3
BLAKE2b-256 checksum
How to use checksums
306a66a21e315c1484c97828055df719c2bb52f424f362f5649b91d7cfbb3b0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / stg_layers-0.1.0-py3-none-any.whl

Download URL stg_layers-0.1.0-py3-none-any.whl
Size 18.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d1b24bb5086d488f0a069d7f8699af8bb48c367204b32132621830107d997e5d
BLAKE2b-256 checksum
How to use checksums
dbe168d244e1892ed7b7d40ed0e825dba0803369624e4e066e1d48945c42a7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for stg-layers 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page