jj-squash(1)

πŸ’– NAME πŸ’–

jj-squash β€” move changes from a revision into another revision. it's giving "combine two things into one" and honestly? iconic.


✨ SYNOPSIS ✨

jj squash [-r|--revision] [-R|--repository] [-f|--from]
[--ignore-working-copy] [--no-integrate-operation] [-t|--into]
[--ignore-immutable] [-o|--onto] [-A|--insert-after] [--at-operation]
[-B|--insert-before] [--debug] [--color] [-m|--message] [--quiet]
[-u|--use-destination-message] [--editor] [--no-pager] [--config]
[-i|--interactive] [--config-file] [--tool] [-k|--keep-emptied]
[-h|--help] [FILESETS]

okay so bestie, this is jj-squash(1) β€” yeah we're in section 1 of the General Commands Manual 😌 stay with me, it's gonna slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

Move changes from a revision into another revision. that's the whole vibe. you're taking changes from one place and shoving them somewhere else 🫢

without any options at all, it moves the changes from the working-copy revision into the parent revision. like, your current work just... merges up into mom. periodt.

with the -r option, it moves the changes from the specified revision into its parent. and it will FAIL if there are several parent revisions β€” i.e., if the given revision is a merge. no merge support here, sorry babe πŸ’€

with the --from and/or --into options, it moves changes from and/or into the given revisions. if either one is left out, it defaults to the working-copy commit. so for example:

jj squash --into @--

moves changes from the working-copy commit to the grandparent. grandparents stay winning fr fr πŸ‘‘

if, after moving changes out, the source revision is empty compared to its parent(s), and --keep-emptied is not set, it will be abandoned. like, ghosted. gone. πŸͺ¦ and just so you know β€” without --interactive or paths, the source revision will always be empty.

if the source got abandoned and both the source and destination had a non-empty description, you will be asked for the combined description. if either one was empty, then the other one gets used instead. democracy ✨

if a working-copy commit gets abandoned, it will be given a new, empty commit. and bestie, this is true in general β€” it's not specific to this command. it's just how the house operates.

the name "squash" comes from the idea of combining (squashing) the changes from multiple revisions together. cute, right? no notes. πŸŽ€

πŸ’… EXPERIMENTAL FEATURES πŸ’…

an alternative squashing UI is available via the -o, -A, and -B options. using any of these options creates a new commit. they can be used together with one or more --from options β€” and if no --from is specified, then --from @ is assumed. yes, it just assumes. main character energy honestly. πŸ™ˆ


🌸 OPTIONS 🌸

  • -r, --revision <REVSET> β€” the revision to squash into its parent (default: @). incompatible with the experimental -o/-A/-B options. they don't play nice together, pick a side πŸ’…
  • -f, --from <REVSETS> β€” the revision(s) to squash from (default: @)
  • -t, --into <REVSET> β€” the revision to squash into (default: @)
  • -o, --onto <REVSETS> β€” (experimental!) the revision(s) to use as the parent for the new commit. can be repeated to create a merge commit 🧚
  • -A, --insert-after <REVSETS> β€” (experimental!) the revision(s) to insert the new commit after. can be repeated to create a merge commit 🌈
  • -B, --insert-before <REVSETS> β€” (experimental!) the revision(s) to insert the new commit before. can be repeated to create a merge commit ⭐
  • -m, --message <MESSAGE> β€” the description to use for the squashed revision (and it will not open an editor, so no surprise popups bestie)
  • -u, --use-destination-message β€” use the description of the destination revision and discard the description(s) of the source revision(s). harsh but valid 😌
  • --editor β€” open an editor to edit the change description. it forces an editor to open when you're using --message, so you can edit that message afterwards. like a second pass, a glow-up πŸ”₯
  • -i, --interactive β€” interactively choose which parts to squash. hand-pick your faves πŸ’–
  • --tool <NAME> β€” specify which diff editor to use (this implies --interactive)
  • -k, --keep-emptied β€” the source revision will not be abandoned. keeping it around even after it's empty, we respect that 🫢
  • -h, --help β€” print help (see a summary with -h)
  • [FILESETS] β€” move only changes to these paths (instead of all paths). narrowing it down, we love a specific queen 🎯

πŸ‘‘ GLOBAL OPTIONS πŸ‘‘

  • -R, --repository <REPOSITORY> β€” path to the repository to operate on

by default, Jujutsu searches for the closest .jj/ directory in an ancestor of the current working directory. it's hunting for its home fr fr 🏠

  • --ignore-working-copy β€” don't snapshot the working copy, and don't update it

by default, Jujutsu snapshots the working copy at the beginning of every command. the working copy is also updated at the end of the command, if the command modified the working-copy commit (@). if you want to avoid snapshotting the working copy and instead see a possibly stale working-copy commit, you can use --ignore-working-copy. this may be useful e.g. in a command prompt, especially if you have another process that commits the working copy. it's giving "i already handled that, leave me alone"

loading the repository at a specific operation with --at-operation implies --ignore-working-copy. they come as a package deal πŸ’«

  • --no-integrate-operation β€” run the command as usual but don't integrate any operations

when this option is given, the operations will still be created as usual but they will not be integrated to the operation log. the working copy will also not be updated.

the command will print the resulting operation ID. you can pass that to e.g. jj --at-op to inspect the resulting repo state, or you can pass it to jj op restore to restore the repo to that state. you can also pass the ID to jj op integrate to integrate the operation.

⚠️ note that this does not prevent side effects outside the repo. for example, jj git push --no-integrate-operation will still perform the push. it says "no integrating" not "no consequences" πŸ’€
  • --ignore-immutable β€” allow rewriting immutable commits

by default, Jujutsu prevents rewriting commits in the configured set of immutable commits. this option disables that check and lets you rewrite any commit but the root commit. rebellious era ✨

this option only affects the check. it does not affect the immutable_heads() revset or the immutable template keyword. so no funny business with those.

  • --at-operation <AT_OPERATION> β€” operation to load the repo at

operation to load the repo at. by default, Jujutsu loads the repo at the most recent operation, or at the merge of the divergent operations if any.

you can use --at-op=<operation ID> to see what the repo looked like at an earlier operation. for example jj --at-op=<operation ID> st will show you what jj st would have shown you when the given operation had just finished. --at-op=@ is pretty much the same as the default except that divergent operations will never be merged. time travel but make it version control πŸ¦‹

use jj op log to find the operation ID you want. any unambiguous prefix of the operation ID is enough.

when loading the repo at an earlier operation, the working copy will be ignored, as if --ignore-working-copy had been specified.

it is possible to run mutating commands when loading the repo at an earlier operation. doing that is equivalent to having run concurrent commands starting at the earlier operation. there's rarely a reason to do that, but it is possible. (chaotic. i respect it. πŸ™ˆ)

  • --debug β€” enable debug logging
  • --color <WHEN> β€” when to colorize output

possible values:

  • always
  • never
  • debug
  • auto
  • --quiet β€” silence non-primary command output

for example, jj file list will still list files, but it won't tell you if the working copy was snapshotted or if descendants were rebased. so it did the thing, it's just not narrating πŸ’…

warnings and errors will still be printed. those never get silenced, bestie.

  • --no-pager β€” disable the pager
  • --config <NAME=VALUE> β€” additional configuration options (can be repeated)

the name should be specified as TOML dotted keys. the value should be specified as a TOML expression. if the string value isn't enclosed by any TOML constructs (such as array notation), quotes can be omitted. ✨

  • --config-file <PATH> β€” additional configuration files (can be repeated)

and that's the whole page, bestie πŸ’– you just read squash β€” that's the footer's little signature, sitting right there next to jj-squash(1) in the General Commands Manual (no date stamp on this one, it's timeless πŸ’…). go squash something and make it cute. slay! πŸŽ€βœ¨πŸ‘‘

πŸ“¦ where this page comes from