Keep track of changes through rebases
Revue has two optional git hooks. The one most people want records each amend and rebase, so Revue knows exactly which new commit a rewritten one became, and your snapshots and comments follow the change. Neither is installed unless you install it, and only in the checkout you name.
What the hooks do
Section titled “What the hooks do”| Hook | Installs as | What it does |
|---|---|---|
rewrite-log |
post-rewrite |
After an amend or a rebase, hands git’s list of old and new commits to Revue, so a change keeps its identity. It runs the revue command. |
change-id |
commit-msg |
Adds a Gerrit-style Change-Id trailer to each commit message. It needs only git and sh, not Revue. |
Under jj, Revue won’t install the change-id hook, since jj records a change id of its own on every commit. The rewrite log is still worth installing there, because jj never sees a rewrite made with plain git.
Hooks go in the repository’s shared hooks folder, so every worktree of the checkout uses them.
Install them in a checkout
Section titled “Install them in a checkout”The hooks are installed with the revue command. If you don’t have it yet, choose
Revue › Install Command Line Tool and open a new terminal.
In the checkout, run:
revue hooks installWith no flag it installs both. To install one, name it:
revue hooks install --rewrite-logrevue hooks install --change-idEach installed hook is printed with its path, such as installed rewrite-log at …/.git/hooks/post-rewrite.
Revue never overwrites a hook it didn’t write. If the checkout already has a post-rewrite or commit-msg hook of
your own, the install stops and prints the one line to add to your hook instead:
revue hook post-rewrite "$@"revue hooks print --change-id | sh -s -- "$1"Two warnings can follow an install. If the revue command isn’t on your PATH, git will skip the rewrite-log hook,
so install the command and open a new terminal. If core.hooksPath sends git to another folder, git won’t run the
hooks until you copy them there or unset it.
To share the change-id hook with someone who doesn’t use Revue, revue hooks print --change-id writes its script to
the terminal.
Check their status
Section titled “Check their status”revue hooks statusEach hook reads installed, absent, or foreign for a hook of the same name that Revue didn’t write.
Remove them
Section titled “Remove them”revue hooks uninstallLike install, it takes --rewrite-log or --change-id to remove only one. It removes only hooks Revue wrote, and
leaves a hook of your own for you to edit.