In short: jj selects remote bookmarks exactly as jj bookmark track
does, by name@remote symbols or by name patterns with an optional --remote. It
warns about and skips refs on the reserved git remote and refs that aren't tracked. In one
transaction it sets each remaining ref's state to untracked, prints
Stopped tracking N remote bookmarks., and records
untrack remote bookmark <symbols>.
The command is cmd_bookmark_untrack. Its help text points
to jj bookmark forget for removing the
local bookmark at the same time (source).
1. Command-line surface
| Argument | Type | Default | Meaning |
|---|---|---|---|
BOOKMARK[@REMOTE] (positional) | patterns or remote symbols, required | — | Name patterns (globs by default) or exact name@remote symbols, not both (source). |
--remote REMOTE | remote patterns, repeatable | all remotes but git | Which remotes the patterns apply to; not allowed with symbols (source). |
2. Configuration
None of its own. Note that remotes.<name>.auto-track-bookmarks applies to bookmarks new to a
fetch, so an untracked bookmark stays untracked on later fetches; upstream's test fetches with auto-tracking
on and only the tracked main and the new feature3 are merged (source). The reserved git remote can't be
untracked (source, default_ignored_remote_name).
3. End-to-end flow
4. Core architecture touchpoints
| Structure | Read / write | How | Explained on |
|---|---|---|---|
RemoteRef.state | write | Set to New (untracked); the target is kept (untrack_remote_bookmark). | view |
View.local_bookmarks | untouched | The local bookmark keeps its target, and appears separately from the remote one in listings. | view |
| Commits | untouched | Nothing is created, rewritten or hidden. | commits |
| Operation | write | One operation if anything was untracked; otherwise Nothing changed. | operations |
5. Transaction and operation
- Transaction: always started; with nothing to untrack,
tx.finishprintsNothing changed.(source). - Operation description:
untrack remote bookmark <name@remote, …>(source). - Commits: none created or rewritten.
jj undo, orjj bookmark track, restores the tracking.
6. Algorithm and invariants
Selection reuses resolve_trackable_remote_bookmarks and
trackable_remote_bookmarks_matching, the same helpers as
track (source). Because the latter also yields absent
placeholders for local bookmarks, those show up as "not tracked yet" warnings rather than silently.
Each selected ref is then filtered (source):
- On the
gitremote: warned and skipped. The source notes the restriction could be lifted. - Not tracked: warned and skipped.
- Otherwise: untracked, which only flips
state.
Invariants: no target changes, local or remote. A locally deleted bookmark can be untracked too; its remote entry then simply remains as an untracked remote bookmark, and pushing no longer deletes it.
7. Errors and edge cases
| Message | When | Source |
|---|---|---|
Cannot specify both <bookmark> patterns and <bookmark>@<remote> symbols | Mixed argument forms. | untrack.rs |
--remote cannot be used with <bookmark>@<remote> symbols | Both given. | untrack.rs |
Warning: Git-tracking bookmark cannot be untracked: <symbol> | A ref on the git remote. | untrack.rs |
Warning: Remote bookmark not tracked yet: <symbol> | Already untracked, or an absent placeholder. | untrack.rs |
Warning: No matching remote bookmarks for names: … and the other unmatched warnings | As for track. | mod.rs |
Nothing changed. | Nothing was untracked. | cli_util.rs |
8. Worked example
From upstream's test_bookmark_track_untrack, continuing the
track example. After
jj bookmark delete feature2, jj bookmark untrack feature1@origin feature2@origin
prints Stopped tracking 2 remote bookmarks. Then the remote moves all three branches to commit 2
and the test fetches:
Upstream's fetch output (source):
bookmark: feature1@origin [updated] untracked
bookmark: feature2@origin [updated] untracked
bookmark: main@origin [updated] tracked
The test's comment sums it up: "Only tracking bookmark "main" should be merged."