---
title: "Rewrite a change"
description: "Describe a change, give it another author, split it by paths, and rebase it onto main, onto another change, or onto two at once, keeping its change ID through every rewrite."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.forge.workreef.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Rewrite a change

A change keeps its ID however often you rewrite it, as in jj: each rewrite is a new commit of the same change, and each is an operation in the repository's log that you can [undo](https://docs.forge.workreef.dev/af/undo/). Until a change lands, its description, its author, what it holds and what it is built on are all yours to change.

Start a forge and a change to work on:

```console server
$ af-server --dev
...
```

```console check
$ source ~/af-dev/dev/env
$ af workspace add ~/demo
Workspace at /home/you/demo
Paths: **
main has no landing yet
$ cd ~/demo
$ af new -m "wip"
Working on change xqqltutvnrwryzsltpmvtyvrypyspkrz at commit 1674628baf5c4e271680361c33aa6cdcabb59a97e24924b5c0bee959c760b23d
$ printf 'def greet(name):\n    return "Hello, " + name\n' > greet.py
$ printf 'Greets people by name.\n' > README
```

## Describe it

`af describe` gives the workspace's change a new description. The first line is its summary, as a commit message's; a blank line, then a body, if it needs one. In bash, `$'...'` writes the line breaks as `\n`:

```console check
$ af describe -m $'Add a greeting\n\nGreets a person by name, for the welcome page.'
Change xqqltutvnrwryzsltpmvtyvrypyspkrz is now at commit a35e60297b653e496ad6a9761f6e2dfa86676d91360167bd04d58c1041943c9b
$ af log -r @
@  xqqltutv dev@localhost 2026-11-25T06:31:38Z a35e6029
│  Add a greeting
~
```

## Give it another author

The author is who the change's commits say wrote them; `af new` takes it from `AF_AUTHOR_NAME` and `AF_AUTHOR_EMAIL`. `af metaedit` changes it, for a change written with someone else:

```console check
$ af metaedit --author "Ana Lima <ana@example.com>"
Change xqqltutvnrwryzsltpmvtyvrypyspkrz is now at commit f8f669baac8ad51ee3bd1d5054b94ed4522bb3b0d9ce4be6fb473bd0529cc342
$ af show -r @
Commit ID: f8f669baac8ad51ee3bd1d5054b94ed4522bb3b0d9ce4be6fb473bd0529cc342
Author   : Ana Lima <ana@example.com> (2026-11-25T06:31:38Z)
Parents  : 0000000000000000000000000000000000000000000000000000000000000000

    Add a greeting
    
    Greets a person by name, for the welcome page.

A README
A greet.py
```

The forge still records who wrote each commit to it, its writer, and the author does not change that.

## Split it by paths

`af split` keeps the edits at the paths you name in the change, as glob patterns from the repository's root, and moves the rest to a new change on top of it, which becomes your workspace's. The new change takes the old description; `-m` gives the original a new one:

```console check
$ af split '*.py' -m "Add a greet function"
Rewrote change xqqltutvnrwryzsltpmvtyvrypyspkrz at commit 719152668eba11561cb0a2ac017b55214d01eb5bbba13a69aec2ad01e4470a0c
Rewrote change rzlqpoqlrmklupnzlypwznnopvttoqnt at commit 0a9d955c1be81f56e80743e1dc856c2e16a9470af6cb80d637e8acbb06ea44ec
$ af describe -m "Explain the greeting"
Change rzlqpoqlrmklupnzlypwznnopvttoqnt is now at commit 0f369f71e806af5711fe77c8966c6ddcd9f506fbe8d2dd82f893b0041dd0aadb
$ af log -r 'main..@'
@  rzlqpoql ana@example.com 2026-11-25T06:31:38Z 0f369f71
│  Explain the greeting
○  xqqltutv ana@example.com 2026-11-25T06:31:38Z 71915266
│  Add a greet function
~
```

## Rebase it

`af rebase` moves a change onto another base, and the changes built on it follow. `-s` names the change to move, the workspace's by default; `-o` names where to. The readme does not need the function. Note the function's change ID first, `@-`, the change below yours; the lab keeps it in `GREET`, where you would copy it:

```console check
$ af log -r '@-'
○  xqqltutv ana@example.com 2026-11-25T06:31:38Z 71915266
│  Add a greet function
~
$ export GREET=$(af log -r '@-' | awk 'NR == 1 { print $2 }')
```

Move the readme onto main's tip, here the root, since nothing has landed. It no longer has the function below it, and the files on disk follow:

```console check
$ af rebase -o 'main'
Rewrote change rzlqpoqlrmklupnzlypwznnopvttoqnt at commit 91b20e1c67d3ded7217a162f33e28e295653f023553c8a367c37c2b89b2e2eee
$ af log -r 'main..@'
@  rzlqpoql ana@example.com 2026-11-25T06:31:38Z 91b20e1c
│  Explain the greeting
~
$ ls
README
```

The function's change is where it was, open. Name it by its change ID to put the readme back on it:

```console check
$ af rebase -o "$GREET"
Rewrote change rzlqpoqlrmklupnzlypwznnopvttoqnt at commit c981c26d867548d7d8b9decc01176911edf656c1cad0d8406050ba03989d2948
$ af log -r 'main..@'
@  rzlqpoql ana@example.com 2026-11-25T06:31:38Z c981c26d
│  Explain the greeting
○  xqqltutv ana@example.com 2026-11-25T06:31:38Z 71915266
│  Add a greet function
~
```

Naming more than one destination, `-o` twice, makes the change a merge of them: it builds on each, and lands only once each has. A rebase is refused if any change it touches has moved since you last saw it, so it never overwrites work you have not seen.

## Next

- [Shape a stack](https://docs.forge.workreef.dev/af/stacks/): splitting a change and moving an edit down the stack.
- [`af describe`](https://docs.forge.workreef.dev/reference/af/describe/), [`af metaedit`](https://docs.forge.workreef.dev/reference/af/metaedit/), [`af split`](https://docs.forge.workreef.dev/reference/af/split/) and [`af rebase`](https://docs.forge.workreef.dev/reference/af/rebase/) in the reference.

Source: https://docs.forge.workreef.dev/af/rewrite/index.mdx
