Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
jj-rebase(1)		     General Commands Manual		    jj-rebase(1)

NAME
     jj-rebase - Move revisions to different parent(s)

SYNOPSIS
     jj    rebase    [-b|--branch]   [-R|--repository]	 [--ignore-working-copy]
     [-s|--source]  [--no-integrate-operation]	 [-r|--revision]   [--ignore-im-
     mutable]  [-o|--onto] [-A|--insert-after] [--at-operation] [-B|--insert-be-
     fore] [--debug]  [--color]  [--skip-emptied]  [--keep-divergent]  [--quiet]
     [--no-pager] [--simplify-parents] [--config] [--config-file] [-h|--help]

DESCRIPTION
     Move revisions to different parent(s)

     This  command  moves  revisions to different parent(s) while preserving the
     changes (diff) in the revisions.

     There are three different ways of specifying which revisions to rebase:

     * `--source/-s` to rebase a revision and its descendants * `--branch/-b` to
     rebase a whole branch, relative to the destination  *  `--revisions/-r`  to
     rebase the specified revisions without their
       descendants

     If no option is specified, it defaults to `-b @`.

     There  are three different ways of specifying where the revisions should be
     rebased to:

     * `--onto/-o` to rebase the revisions onto the specified targets  *  `--in-
     sert-after/-A` to rebase the revisions onto the specified targets and
       to  rebase  the	targets' descendants onto the rebased revisions * `--in-
     sert-before/-B` to rebase the revisions onto the specified targets'
       parents and to rebase the targets and their descendants onto the rebased
       revisions

     See the sections below for details about the different ways  of  specifying
     which revisions to rebase where.

     If  a  working-copy  revision gets abandoned, it will be given a new, empty
     revision. This is true in general; it is not specific to this command.

     ### Specifying which revisions to rebase

     With `--source/-s`, the command rebases the specified revision and its  de-
     scendants	to  the  destination.  For  example, `jj rebase -s M -o O` would
     transform your history like this (letters followed  by  an  apostrophe  are
     post-rebase versions):

     ```text  O 	   N'  |	    |  |  N	    M' | |	   | | M
     O | |    =>   | | | L	 | L  |  |/	    |  |  |  K		|  K  |/
     |/ J	    J ```

     Each revision passed to `-s` will become a direct child of the destination,
     so if you instead run `jj rebase -s M -s N -o O` (or `jj rebase -s 'M|N' -o
     O`) in the example above, then N' would instead be a direct child of O.

     With  `--branch/-b`,  the command rebases the whole "branch" containing the
     specified revision. A "branch" is the set of revisions that includes:

     * the specified revision and ancestors that are not also ancestors of the
       destination * all descendants of those revisions

     In other words, `jj rebase -b X -o  Y`  rebases  revisions  in  the  revset
     `(Y..X)::`  (which is equivalent to `jj rebase -s 'roots(Y..X)' -o Y` for a
     single root). For example, either `jj rebase -b L -o O` or `jj rebase -b  M
     -o  O`  would  transform your history like this (because `L` and `M` are on
     the same "branch", relative to the destination):

     ```text O		 N' |		| | N	       M'  |  | 	 |  |  M
     |	L'  |  |     =>    |/  |  |  L	      K'  | |/	      | | K	    O |/
     | J	   J ```

     With `--revisions/-r`, the command rebases only the specified revisions  to
     the  destination. Any "hole" left behind will be filled by rebasing descen-
     dants onto the specified revisions' parent(s). For example, `jj rebase -r K
     -o M` would transform your history like this:

     ```text M		K' |	      | | L	   M | |   =>	| |  K	       |
     L' |/	   |/ J 	 J ```

     Multiple  revisions  can  be  specified, and any dependencies (graph edges)
     within the set will be preserved. For example, `jj rebase -r  'K|N'  -o  O`
     would transform your history like this:

     ```text  O 	   N'  |	    |  |  N	    K' | |	   | | M
     O | |    =>   | | | L	 | M'  |  |/	     |/  |  K	       |  L'  |/
     |/ J	    J ```

     `jj  rebase -s X` is similar to `jj rebase -r X::` and will behave the same
     if X is a single revision. However, if X is a set of multiple revisions, or
     if you passed multiple `-s` arguments, then `jj rebase -s` will  make  each
     of the specified revisions an immediate child of the destination, while `jj
     rebase -r` will preserve dependencies within the set.

     Note  that  you can create a merge revision by repeating the `-o` argument.
     For example, if you realize that revision L actually depends on revision  M
     in order to work (in addition to its current parent K), you can run `jj re-
     base -s L -o K -o M`:

     ```text  M 	  L'  | 	  |\  |  L	  M | | |   =>	 | | | K
     | K |/	    |/ J	  J ```

     ### Specifying where to rebase the revisions

     With `--onto/-o`, the command rebases the selected revisions onto the  tar-
     gets.  Existing  descendants  of  the targets will not be affected. See the
     section above for examples.

     With `--insert-after/-A`, the selected revisions will be inserted after the
     targets. This is similar to `-o`, but if the targets have any existing  de-
     scendants, then those will be rebased onto the rebased selected revisions.

     For  example, `jj rebase -r K -A L` will rewrite history like this: ```text
     N		 N' |		| | M	      | M' |/	       |/ L	 =>   K'
     |		 | | K	       L |/	     | J	   J ```

     The `-A` (and `-B`) argument can also be used for reordering revisions. For
     example, `jj rebase -r M -A J` will rewrite history like  this:  ```text  M
     L'  |	     |	L	    K' |     =>   | K	       M' |	     | J
     J ```

     With `--insert-before/-B`, the selected revisions will be	inserted  before
     the  targets.  This is achieved by rebasing the selected revisions onto the
     target revisions' parents, and then rebasing the target revisions and their
     descendants onto the rebased revisions.

     For example, `jj rebase -r K -B L` will rewrite history like this:  ```text
     N		 N' |		| | M	      | M' |/	       |/ L	=>    L'
     |		 | | K	       K' |/	      | J	    J ```

     The  `-A`	and  `-B`  arguments  can  also be combined, which can be useful
     around merges. For example, you can use `jj rebase -r K -A J -B M` to  cre-
     ate  a  new  merge (but `jj rebase -r M -o L -o K` might be simpler in this
     particular case): ```text M	   M' | 	  |\ L		 L  |  |
     =>    | | | K	   | K' |/	    |/ J	   J ```

     To  insert  a  commit inside an existing merge with `jj rebase -r O -A K -B
     M`: ```text O	     N' |	    |\ N	   | M' |\	    | |\
     | M	 | O'| | |    =>   |/ / | L	    | L |  |	      |  |  K  |
     K | |/	     |/ J	    J ```

OPTIONS
     -b, --branch <REVSETS>
	    Rebase  the whole branch relative to destination's ancestors (can be
	    repeated)

	    `jj   rebase   -b=br   -o=dst`   is   equivalent   to   `jj   rebase
	    '-s=roots(dst..br)' -o=dst`.

	    If	none of `-b`, `-s`, or `-r` is provided, then the default is `-b
	    @`.

     -s, --source <REVSETS>
	    Rebase specified revision(s) together with their  trees  of  descen-
	    dants (can be repeated)

	    Each  specified  revision will become a direct child of the destina-
	    tion revision(s), even if some of the source revisions  are  descen-
	    dants of others.

	    If	none of `-b`, `-s`, or `-r` is provided, then the default is `-b
	    @`.

     -r, --revision <REVSETS>
	    Rebase the given revisions, rebasing  descendants  onto  this  revi-
	    sion's parent(s)

	    Unlike  `-s`  or  `-b`, you may `jj rebase -r` a revision `A` onto a
	    descendant of `A`.

	    If none of `-b`, `-s`, or `-r` is provided, then the default is  `-b
	    @`.

     -o, --onto <REVSETS>
	    The  revision(s)  to  rebase onto (can be repeated to create a merge
	    commit)

     -A, --insert-after <REVSETS>
	    The revision(s) to insert after (can be repeated to create	a  merge
	    commit)

     -B, --insert-before <REVSETS>
	    The  revision(s) to insert before (can be repeated to create a merge
	    commit)

     --skip-emptied
	    If true, when rebasing would produce an empty commit, the commit  is
	    abandoned.	It  will not be abandoned if it was already empty before
	    the rebase. Will never skip merge commits  with  multiple  non-empty
	    parents

     --keep-divergent
	    Keep divergent commits while rebasing

	    Without this flag, divergent commits are abandoned while rebasing if
	    another  commit  with  the	same change ID is already present in the
	    destination with identical changes.

     --simplify-parents
	    Simplify parents of rebased  commits,  like  `jj  simplify-parents`,
	    while rebasing them. Any parents that are ancestors of other parents
	    will be removed

     -h, --help
	    Print help (see a summary with '-h')

GLOBAL OPTIONS
     -R, --repository <REPOSITORY>
	    Path to repository to operate on

	    By	default,  Jujutsu  searches for the closest .jj/ directory in an
	    ancestor of the current working directory.

     --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-work-
	    ing-copy`.	This  may be useful e.g. in a command prompt, especially
	    if you have another process that commits the working copy.

	    Loading the repository at a specific operation with `--at-operation`
	    implies `--ignore-working-copy`.

     --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 opera-
	    tion.

	    Note that this does *not* prevent side effects outside the repo. For
	    example, `jj git push --no-integrate-operation` will  still  perform
	    the push.

     --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.

	    This option only affects the check. It  does  not  affect  the  `im-
	    mutable_heads()` revset or the `immutable` template keyword.

     --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 opera-
	    tions 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.

	    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.

     --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  re-
	    based.

	    Warnings and errors will still be printed.

     --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 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)

				     rebase			    jj-rebase(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=jj-rebase&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help