repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
jj.mdMarkdown485 lines33.1 KiBsource raw download

jj — git without the staging area#

Jujutsu is a VCS that speaks git on the wire and something much simpler on your side of it. Installed here as jj 0.44, config at ~/.config/jj/config.toml, shell aliases in ~/.dotfiles/config/jj.zsh. Terminal card: jj-cheat — sections setup flow model words repo see work move book git branch undo fix rev xlat mine. jj-cheat setup is the one to read first. Short alias list: jjhelp. Full 40-page guide: NetrunnerVault/04Tools/jj-field-guide/jj-field-guide.pdf.

Setup — from a folder to GitHub#

Do this once per repo. After it, you only ever run the four-move ritual below.

cd ~/git/thing
jj git init                                          # .jj + .git, colocated
jj git remote add origin git@github.com:USER/repo.git # where GitHub is
jj git fetch                                          # learn what GitHub has
jj bookmark track main@origin                         # marry your main to theirs — ONCE, ever
jj-commit "vault: first import of notes"              # seal your work
jj bookmark set main -r @-                            # move the sticky note onto it
jj git push                                           # send it

If GitHub's repo is empty there is no main@origin to track yet. Create it with no README, no .gitignore, no license, then:

jj git init
jj git remote add origin git@github.com:USER/repo.git
jj-commit "Initial commit"
jj bookmark create main -r @-
jj git push -b main            # -b creates it on GitHub AND tracks it

A plain jj git push refuses to invent a bookmark on GitHub — that is the safety net that stops a half-baked branch escaping:

Warning: Refusing to create new remote bookmark main@origin
Hint: Run `jj bookmark track main@origin` and try again.
Nothing changed.

There is no --allow-new flag in jj. Naming it with -b main is you saying yes, publish this one, and jj tracks the pair for you. From the second push on, plain jj git push carries main.

If the repo already lives on GitHub, let jj make the local copy and tracking comes free:

jj git clone --colocate https://github.com/USER/repo.git Thing
bookmark: main@origin [new] tracked
Setting the revset alias `trunk()` to `main@origin`.
Parent commit (@-): qtvtpwxm f34fe73b main | Initial commit

That [new] tracked line is the tracking setup — you never type jj bookmark track on this path.

If you already have the folder and a git remote, jj slides in without disturbing anything; history is imported and uncommitted work becomes @, nothing is stashed:

cd ~/dotfiles
jj git init
printf '\n.jj/\n' >> .gitignore   # jj does NOT ignore itself; git would track .jj/
jj bookmark track main@origin
jj st                             # your uncommitted files are already in @

Set your identity once per computer, before the first commit — that avoids the author will stay … warning you get for changing identity mid-repo:

jj config set --user user.name  "DAEMON"
jj config set --user user.email "you@example.com"
jj config list user

Checkpoint. jj bookmark list --all-remotes — three lines, all quoting the same change ID, means fully published. main: is your note, @git: is the colocated .git's copy (bookkeeping), @origin: is GitHub's copy. Indented under main means the pair is tracked.

The ritual — four moves, every publish#

jj st                          # 1. look: what did I change?
jj commit -m "update: ..."     # 2. seal it with a message
jj bookmark set main -r @-     # 3. move the sticky note onto it
jj git push                    # 4. send it to GitHub

Move 3 is the one git did for you invisibly. Skip it and push succeeds, changes nothing, and warns in a line that is easy to walk past:

Warning: No bookmarks/tags found in the default push revset:
remote_bookmarks(remote=origin)..@
Nothing changed.

Set the bookmark and push again, and both commands say what they did:

Moved 1 bookmarks to kmpmlqyt 5a24a49b main* | nmap: add UDP top-100 sweep
Changes to push to origin:
  bookmark: main [move forward from 2adbd45d331b to 5a24a49be1b7]

The * after main means ahead of GitHub. After the push it disappears. move forward means a clean fast-forward — nothing was overwritten.

Stop running jj commit after the bookmark move. Moving a bookmark relabels; it creates nothing that needs committing, so the second commit just seals an empty change. Commit once, move the note, push. Three moves, not five.

The one idea#

The working copy is a commit, called @. It already exists before you type anything, and every edit you make lands in it automatically — jj snapshots the tree at the start of every command.

There is no index, so there is no git add, no git stash, and nothing to forget to stage. The question stops being "what do I stage and commit?" and becomes "which commit am I editing right now?" — the answer is @ until you move it with jj new or jj edit.

@- is the commit right below you. History is a stack: @ on top, @- its parent, @-- one further down. jj commit seals your work and opens a fresh empty @ on top — so one second after committing, the work you just finished lives at @-. That is why every bookmark command says -r @- and never -r @.

before:  @  <- your edits, unsealed        after:  @  <- new, EMPTY, ready for tomorrow
         o  <- yesterday                           o  <- your sealed work   = @-
                                                   o  <- yesterday          = @--

Bookmarks never move by themselves. A bookmark is a sticky note with a name, stuck to exactly one commit. main is a sticky note. Nothing lives "inside" it and you are never "on" it. You commit ten times and it still points at the old commit. GitHub reads main's sticky note, so until you move it, GitHub keeps seeing last week's work.

Every commit carries two ids: a change ID (letters, e.g. kmzwqxpl) that is stable across every rewrite, and a commit ID (the git hash) that changes whenever the commit does. Use the change id anywhere you would have copied a sha — it survives describe, squash and rebase.

jj splits "record my work" from "publish my work" so nothing ever leaves your machine as a side effect. The price is one extra command. The payoff: every commit, bookmark move, fetch and mistake is an operation in jj op log, and jj undo reverses any of them. Rewriting is the normal mode of work, not surgery — amend a commit in the middle of a stack and every descendant is rebased for you.

The words#

term what it means
change one saved snapshot of the whole tree — git's "commit"
change ID letters (ptxpotvt); survives every rewrite. Prefer it.
commit ID hex (d3020f8c); the git hash, changes with the content
@ the working-copy commit — your files, right now
@- / @-- parent / grandparent of @. Sealed work lands at @-.
bookmark named sticky note on exactly one change. git's branch.
main your note, on this machine
main@origin jj's record of where GitHub's main is — a different note
tracked the one-time marriage of main to main@origin
revision / -r "which change?" — @, @-, a change ID, or a bookmark name
operation any command that touched the repo; listed in jj op log
colocated .jj/ and .git/ side by side, so git tools keep working

The picture everything reduces to — two sticky notes, one cloud:

  @              <- your desk, right now
  |
  o  <- main            your note: sealed work        = @-
  |
  o  <- main@origin     what GitHub still has (behind)
  |
  o  older history            push = make theirs match yours

When a command confuses you, ask: which sticky note is it about, and which commit should that note point at?

In a colocated repo git status says "not currently on any branch". That is normal here, not damage — read jj bookmark list instead.

Reading the repo#

Read jj st as a sentence — "@ holds a modified note.md and has no description yet; the change below it is the last thing I sealed":

Working copy changes:
M note.md
Working copy  (@) : pqtwmqkw 6fba7d6c (no description set)
Parent commit (@-): ykywxwny 5a23fea5 notes: expand field notes

Read jj bookmark list --all-remotes as a diagnosis: all three lines quoting the same change ID means fully published; @origin quoting an older ID marked (behind by 1 commits) means you moved the note but have not pushed; main itself quoting an old ID while jj log shows newer work means you committed but forgot the move.

Making changes#

The word (empty) on the @ line is the success signal after a commit — your edits were sealed below and you are standing on a clean slate:

Working copy  (@) now at: qwvxwwts 97614bab (empty) (no description set)
Parent commit (@-)      : ykywxwny 2524f49b notes: expand field notes

Saved here is not visible on GitHub. A commit lives only on this machine until the main note moves onto it and you push. Stop after jj commit and GitHub shows the old files, with zero warnings. That is the number-one jj gotcha, and why the ritual has four steps.

Commit messages#

Four ways, all producing subject / blank line / body:

jj commit -m "nmap: add UDP top-100 sweep"        # one line, the everyday case
jj commit -m "subject" -m "body para"             # each -m becomes a paragraph
jj commit -m "$(cat /tmp/commit-msg.txt)"         # the whole file, newlines and all
jj describe -r @- --stdin < /tmp/commit-msg.txt   # rewrite an old message from a file
jj commit                                         # no -m: opens $EDITOR on a template

The template's JJ: lines are comments and get stripped. Save it empty to abort — jj leaves the change untouched and prints Nothing changed. The same flags work on jj squash -m and jj split -m; --editor forces the editor open even when -m was given. jj refuses to push a change whose message is empty, so give every commit a few honest words.

jj-commit is the local wrapper — the same workflow plus an ISO timestamp and the machine hostname:

jj-commit "feat: add parser"              # commit @ and start the next change
jcm "feat: add parser"                    # short alias for the same command
jj-commit --push "feat: add parser"       # commit, then jj git push --change @-
jcmp "feat: add parser"                   # short commit-and-push alias
jj-commit --dry-run "feat: add parser"    # preview message and actions only
jj-commit                                 # no message: read it from stdin (Enter, then Ctrl-D)
feat: add parser

Commit-Date: 2026-09-01T21:39:15+01:00
Commit-Host: omarchy

There is deliberately no --add: jj snapshots the working-copy commit automatically. After jj commit the completed change is @- and @ is the fresh empty child, so --push runs jj git push --change @- — an auto-named push-<change-id> bookmark, not main. To publish main it is still jj bookmark set main -r @- then jj git push.

Related shell helpers: commitdate prints the same ISO date format, commithost prints the hostname, and datestamp prints a filename-safe timestamp. The Git twin is git-commit (gcm), with explicit --add and --push options.

Bookmarks (jj's branches)#

Nothing is ever "checked out". A bookmark is a pointer you move deliberately — it does not follow you as you commit. Moving one never changes your files; it relabels, and jj undo reverses it.

jj bookmark set main -r @-, word by word: jj the tool · bookmark set "put a sticky note somewhere", creating it if new · main which note · -r "on revision …" · @- the commit below @, which is your sealed work. First time it answers Created, afterwards Moved.

Three questions everyone asks: "Am I on main right now?" — no, that question does not exist in jj; you stand on commits and main is a label. "Does moving a bookmark change my files?" — never. "I set it to the wrong commit" — jj undo, or just set it again with the right -r. Working with no bookmark at all is fine: anonymous heads still show in jj log, so there is no "you are on the wrong branch" state to be caught by.

delete means "gone everywhere" — the deletion travels to GitHub on your next push. forget means "stop tracking it here, leave GitHub alone." If unsure, you want forget.

Push#

jj git push does not mean "upload my latest work". It means: for every tracked sticky note that moved, make GitHub's copy match mine. If no note moved there is nothing to say, and push does nothing — successfully and quietly.

A bookmark GitHub has never seen is not allowed to leave on a plain jj git push — you must name it the first time with -b NAME (or --change / --named), which also tracks the pair. Commits with empty descriptions are refused unless you pass --allow-empty-description.

track and set look like cousins. They are not: jj bookmark track main@origin is plumbing you run once, ever; jj bookmark set main -r @- is a daily move, forever.

Fetch and sync#

There is no jj pull, on purpose — fetching and rewriting your work are separate decisions:

jj commit -m "wip: checkpoint before sync"   # 1. never sync over a messy desk
jj git fetch                                 # 2. download only — jf fetches all remotes
jj log                                       # 3. LOOK before merging anything
jj rebase -o main@origin                     # 4. replay my stack onto GitHub's newest
jj bookmark set main -r @-
jj git push

Fetch updates main@origin and never edits your files, so there is no "your local changes would be overwritten" refusal. Two healthy answers: Nothing changed. (usual on a one-machine repo) or bookmark: main@origin [updated] tracked. git.auto-local-bookmark is not set here, so a fetched remote bookmark does not become a local one on its own — that is exactly why jj bookmark track main@origin is a real setup step. In jj log, main@origin sitting directly below your work means you were simply ahead — nothing to integrate.

Never plain git pull in a colocated repo. It goes behind jj's back, can jam the .git into a merge state, and can silently combine two versions of a file. The jj spelling is jj git fetch, look, jj rebase -o main@origin.

main?? — both sides moved. jj is refusing to guess, and nothing is lost:

main (conflicted):
  - pyuuvvoq af1de6ad tmux: add pane, session and zoom cheats
  + tkqsrolo 65bc137b nmap: add -T4 to fast sweep
  + lxmrmuxm fd61cf23 nmap: bump fast sweep to --min-rate 5000
  @git (behind by 1 commits): tkqsrolo 65bc137b nmap: add -T4 to fast sweep
  @origin (behind by 1 commits): lxmrmuxm fd61cf23 nmap: bump fast sweep to --min-rate 5000

The note used to sit on the - line; now there are two + candidates, yours and GitHub's. Two clean exits:

# keep BOTH (the usual choice)
jj rebase -o main@origin
jj bookmark set main -r @-
jj git push

# GitHub WINS — your commits stay in jj log for salvage
jj bookmark set main -r main@origin
jj new main

Side branches#

In jj you do not need a branch to start working — you only need a bookmark at the moment GitHub has to see it.

jj new main                       # 1. clean empty @ sitting on main
jj commit -m "draft: crazy idea"  # 2. seal it
jj bookmark create idea -r @-     # 3. stick a new note on it
jj git push -b idea               # 4. first push needs -b (creates + tracks)

Updating it later is the pattern you already know with a different name in the middle: jj commit, jj bookmark set idea -r @-, jj git push. One pattern, every bookmark.

Switching is just choosing what to stand on next — jj new main or jj new idea. Files switch instantly. Uncommitted edits live in @, and jj new leaves that @ behind as its own change, retrievable from jj log. This is why jj has no stash.

Done with it: jj bookmark delete idea then jj git push --deleted. The commits stay in jj log — only the label goes. Cleaning a stray push-xxxx branch is the same move: find it with jj bookmark list --all-remotes, jj bookmark delete push-utnprnylpqwx, jj git push --deleted.

Moving history#

jj rebase takes a scope and a destination:

flag scope
-r <rev> that revision only; its descendants stay where they are
-s <rev> that revision and its descendants
-b <rev> the whole branch containing it
-o / -d <dest> destination — repeat -o to build a merge
-A / -B <rev> splice in after / before a revision

Merging a feature, linear (jj rebase -b feat -d main, jj bookmark move main --to feat, jj git push -b main) or as a real merge commit (jj new main feat -m "merge: feat", jj bookmark move main --to @).

trunk() and its ancestors are immutable by default: jj refuses to rewrite them. --ignore-immutable overrides, deliberately.

There is no --continue and no --abort. A rebase that hits a conflict still completes; the conflict is stored inside the commit and waits for you. jj undo is git merge --abort — and unlike git it still works after the merge succeeded.

The operation log#

Every mutation of the repo — commit, rebase, fetch, abandon, even a working-copy snapshot — is an operation, and the whole repo is versioned by them. This is repo-wide; git's reflog never covered you like this.

Undid operation: 660868458073 (2026-08-28 19:08:21) point bookmark main
to commit 51bbfe901b871d1a1653ee921abaf5e0f7ec14d8
Restored to operation: 0298bbd82c8f (…) push bookmark main to git remote origin

Moved the wrong bookmark? jj undo. Rebase made a mess? jj undo. Fetched something weird? jj undo.

Conflicts#

Conflicts are recorded values inside commits, not a mode your shell is trapped in. A conflicting rebase finishes anyway; jj st and jj resolve --list show what is unresolved.

jj's markers are not git's <<<<<<< / ======= / >>>>>>>. One side is written out in full after +++++++; the other is shown as a diff after %%%%%%%:

<<<<<<< conflict 1 of 1
+++++++ lxmrmuxm "nmap: bump fast sweep to --min-rate 5000" (rebase destination)
nmap -sC -sV --min-rate 5000 -oA scans/initial 10.10.11.0/24
%%%%%%% diff from: pyuuvvoq "tmux: add ..." (parents of rebased revision)
\\\\\\\        to: lvvmtnup (rebased revision)
-nmap -sC -sV -oA scans/initial 10.10.11.0/24
+nmap -sC -sV -T4 -oA scans/initial 10.10.11.0/24
>>>>>>> conflict 1 of 1 ends

Delete everything from <<<<<<< to >>>>>>>, type the one line you actually want, save, then jj squash. ui.conflict-marker-style defaults to "diff" in jj 0.44, which is why the second side is a diff rather than both sides dumped whole. Descendants inherit a conflict, so fix it at the source commit and let the stack re-resolve. jj refuses to push conflicted commits, so a half-resolved mess can never reach GitHub.

Symptom → fix#

you see it means / do this
push prints Nothing changed. no note moved — jj bookmark set main -r @-, push again
Non-tracking remote bookmark main@origin exists run jj bookmark track main@origin once, then push
Refusing to create new remote bookmark main@origin first push of a new bookmark — jj git push -b main
GitHub shows old files, jj st clean committed but never moved the note — same fix as above
Won't push commit … since it has no description note points at empty @ — set it to @-
Refusing to move bookmark backwards or sideways typo in -r; you rarely want --allow-backwards
main?? in the log divergence — rebase onto main@origin, or adopt it
(conflict) in the log edit the markers, then jj squash
git status: "not currently on any branch" normal in a colocated repo — read jj bookmark list
did something dumb jj undo. Truly.

The debug ladder — climb until it makes sense:

jj st                          # 1. what does jj think just changed?
jj bookmark list --all-remotes # 2. where is every sticky note?
jj log                         # 3. what shape is history in?
jj op log -n 10                # 4. what did I actually run?
jj undo                        # 5. reverse the last thing I ran

Revsets and templates#

Revsets are the query language accepted anywhere -r is:

revset meaning
@ @- @+ working copy, parent, child
x::y x through y · ::x ancestors · x:: descendants
x..y in y but not x (git's two-dot range)
a & b, ~a and, not — for or, the operator is the pipe character
heads(x) / roots(x) tips / bases of a set
trunk() the main bookmark, whatever it is called
mutable() / immutable() what may be rewritten, what may not
mine(), author("x"), subject("x"), files(glob) filters — subject() matches the first line
empty(), merges(), conflicts(), latest(x, n) shapes and slices

trunk() is set per repo — in this vault it resolves to main@origin. mine, wip and stack are not defined here, so write the predicates out: mine(), mutable() & mine().

Templates control output: -T builtin_log_oneline, builtin_log_compact, builtin_log_detailed, or your own — jj log -T 'change_id.short() ++ " " ++ description' --no-graph for machine-readable listings.

git log --author=x --grep=y is jj log -r 'author("x") & subject("y")'. Careful: description("x") matches the whole message exactly — for a substring it is description(substring:"x"). The same operators work on rebase, abandon, squash and push, which is why jj has so few flags.

Repo bootstrap, tags and cleanup#

Fresh history, keeping the files — the rm -rf .git && git init recipe, without deleting anything:

jj new 'root()' -m "Initial commit"   # empty change parented on the repo root
jj restore --from <old-head>          # pull the whole tree in as this commit's content
jj bookmark set main -r @             # point main at the new one-commit history
jj git remote add origin <NEW-URL>
jj git push --named main=@

The old history is still in the repo (jj log -r 'all()') until you abandon it, so this is reversible.

Tags are lightweight: jj tag set v1.0 -r @-, jj tag list, jj git push --tag v1.0 (--tag 'glob:v*' for a family), jj tag delete v1.0 then push the tag again to propagate it. For an annotated or signed tag, use git inside the colocated repo — git tag -a v1.0 -m "Release" && git push origin v1.0 — then jj git import.

Cleanup: jj bookmark rename old new · jj bookmark delete feat (propagates on next push) · jj bookmark forget feat (local only) · jj abandon 'wip & ~@' (throws away a whole revset; undoable).

git → jj#

git said jj says what changed
git add — gone; jj snapshots @ automatically
git commit jj commit -m "…" same idea, and opens a fresh @ on top
git commit --amend jj squash jj describe for the message alone
git add -p jj squash -i choose hunks
git commit --fixup + autosquash jj absorb no naming anything
branch bookmark renamed, and it never auto-moves
git checkout X jj new X start a fresh change on top of X
detached HEAD — does not exist; @ is a commit you are editing
git stash — not needed; @ holds everything, jj new parks it
git push jj bookmark set main -r @- then jj git push push sends bookmarks, so you move the note first
git push -u origin HEAD jj git push --change @ or -b NAME
git push origin --delete X jj bookmark delete X then jj git push --deleted two halves, on purpose
git pull jj git fetch, look, jj rebase -o main@origin split in two on purpose
git log jj log the graph, with @ marked
git blame jj file annotate <path>
git reflog + reset --hard jj undo one word, undoes any operation
git merge --abort jj undo still works after the merge succeeded
git rebase --continue/--abort — neither exists; the rebase already finished

Immutability and signing#

Aliases on this machine#

Shell (~/.dotfiles/config/jj.zsh, run jjhelp for the card):

alias command
j js jl jll jd jsh jj · status · log · detailed log · diff · show
jn je jdm jsq jsp jr jab new · edit · describe -m · squash · split · rebase · abandon
jb jbc jbm bookmark list / create / move
jf jpush jpushc fetch all remotes · push · push --change @
jcm jcmp commit with date + hostname · commit and push @-
jop jundo jrestore op log · undo · op restore
jjinit jjclone always --colocate

jj ships four built-in aliases that always work: jj st, jj b, jj ci, jj desc. There are no jj l, jj ll, jj tug, jj oops or jj sync on this machine. ~/.config/jj/config.toml is short — it sets only user.name / user.email, signing.backend = "gpg" with key BFB092454FAFECB4, signing.behavior = "own", and snapshot.max-new-file-size = "10MiB" (a bigger new file is not auto-snapshotted). Everything else is a jj 0.44 default: git.colocate = true, ui.conflict-marker-style = "diff", git.track-default-bookmark-on-clone = true.

Wrappers in ~/.dotfiles/bin: jj-commit ([--push] [--dry-run] MSG), git-commit ([--add] [--push] MSG), commitdate, commithost, datestamp.

Getting in cheaply#

Run jj git init in a repo you already have. Colocation means every git command you know keeps working on the same repo, jj log and git log show the same commits, and walking away costs nothing but deleting .jj/.