Jjc: Non-interactive hunk-level operations for Jujutsu

birdculture2 pts0 comments

akashina.tngl.sh/jjc at main · Tangled

akashina.tngl.sh

jjc

Star

21

Fork

Atom

Configure Feed

Issues

Pull Requests

Commits

Tags

Feed URL

Select the types of activity you want to include in your feed.

Non-interactive hunk-level operations for Jujutsu. Scriptable alternative to jj split's interactive mode.

Star

21

Fork

Atom

Configure Feed

Issues

Pull Requests

Commits

Tags

Feed URL

Select the types of activity you want to include in your feed.

Rust

100.0%

main

No tags found

Code

Clone this repository

Use permalink

HTTPS

https://tangled.org/akashina.tngl.sh/jjc<br>https://tangled.org/did:plc:hyd2stem52eu5pl2vlf73zuw<br>getComputedStyle(s).display !== 'none').textContent)"<br>class="px-3 py-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"<br>title="Copy to clipboard"

SSH

git@tangled.org:akashina.tngl.sh/jjc<br>git@tangled.org:did:plc:hyd2stem52eu5pl2vlf73zuw<br>getComputedStyle(s).display !== 'none').textContent)"<br>class="px-3 py-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"<br>title="Copy to clipboard"

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz

Download .zip

.agents

2 weeks ago

src

2 weeks ago

.gitignore

2 weeks ago

Cargo.lock

2 weeks ago

Cargo.toml

2 weeks ago

README.md

2 weeks ago

Commits

chore: update skill to not include impl detail

bb71fdcd

akashina.tngl.sh

1 week ago

main

feat: load gitignore patterns and snapshot config from jj/git settings

Replaces the naive empty-ignores snapshot with proper loading of:<br>- core.excludesFile from git config and .git/info/exclude<br>- snapshot.auto-track fileset for start_tracking_matcher<br>- snapshot.max-new-file-size from user settings

Ported from jj-cli v0.41.0 cli_util.rs.

1172e99a

akashina.tngl.sh

2 weeks ago

fix: include parent-side context in hunk ID to disambiguate identical changes

6ef159af

akashina.tngl.sh

2 weeks ago

Branches

main

1 week ago

Default

README.md

jjc#

Non-interactive hunk-level operations for Jujutsu. Scriptable alternative to jj split's interactive mode.

Requires jj v0.41.0.

Install#

cargo install --git https://tangled.sh/akashina.tngl.sh/jjc # or from local checkout:<br>cargo install --path .

Commands#

jjc hunks — list hunks#

jjc hunks # list all hunks in @<br>jjc hunks --from main # list hunks in a specific revision<br>jjc hunks -r @- # shorthand for --from<br>jjc hunks abc123 # inspect a single hunk (by ID or prefix)<br>jjc hunks --full # include numbered diff lines<br>jjc hunks --blame # annotate each line with originating commit

--from accepts any revset that resolves to one revision. Hunks are listed for that revision's diff against its parent, so jjc hunks --from @- shows the parent commit's own hunks rather than the working copy's hunks.

Default output shows a changed-lines preview (up to 4 lines):

a1b[2c3d4e5f6] src/main.rs (+3 -1)<br>+ println!("new line");<br>- old_call();

f09[8a7b6c5d4e] src/lib.rs (+1 -0)<br>+use std::io;

--full adds context lines with line numbers, and lists change atoms when a hunk has more than one:

a1b[2c3d4e5f6] src/main.rs (+3 -1)<br>1: fn main() {<br>2:+ println!("new line");<br>3:- old_call();<br>4: }<br>a1b[2c3d4e5f6]#1 @2 a1b[2c3d4e5f6]#2 @3

Hunk IDs use bracket-style prefix highlighting (same as jj log): a1b[2c3d4e5f6] means a1b is the shortest unique prefix.

jjc pick — split hunks into a new commit#

jjc pick a1b -m "extract logging" # pick entire hunk<br>jjc pick a1b#2 -m "fix off-by-one" # pick a single change atom<br>jjc pick a1b@15-20 -m "refactor" # pick by target line range<br>jjc pick a1b c3d -r foo -m "partial" # pick multiple hunks from revision foo

Creates a new commit with the selected hunks, then rewrites the source revision on top of it (like jj split but non-interactive).

jjc drop — revert hunks to parent content#

jjc drop a1b # drop a hunk from @<br>jjc drop a1b c3d # drop multiple hunks

Rewrites the revision in place with selected hunks reverted. Like "Revert Hunk" in a diff editor.

jjc fold — squash hunks into another revision#

jjc fold a1b --into main # fold hunk from @ into main<br>jjc fold a1b -r feat --into main # fold from a specific source<br>jjc fold --select feat:a1b,c3d # multi-source with explicit assignment

Hunk selectors#

All write commands (pick, drop, fold) accept hunk selectors:

Form<br>Meaning

a1b<br>Entire hunk matching ID prefix a1b

a1b#2<br>Change atom #2 within the hunk

a1b@15<br>Lines covering target line 15

a1b@10-20<br>Lines covering target range 10-20

Use jjc hunks to discover IDs and atom indices.

How it works#

jjc reads the jj repository directly via jj-lib. It loads your jj config (user, repo, workspace layers), snapshots the working copy, and commits transactions with proper descendant rebasing and working copy updates. No jj commands are shelled out or proxied.

Limitations#

Only text file hunks are supported. Binary files, renames, copies, additions, and deletions are listed as unsupported.

Immutable commit checking is minimal (root commit...

hunks hunk from main pick text

Related Articles