Skip to content

Commit c0fc686

Browse files
trastgitster
authored andcommitted
Documentation: document post-rewrite hook
This defines the behaviour of the post-rewrite hook support, which will be implemented in the following patches. We deliberately do not document how often the hook will be invoked per rewriting command, but the interface is designed to keep that at "once". This would currently not matter too much, since both rebase and filter-branch are shellscripts and spawn many processes anyway. However, when a fast sequencer in C is implemented, it will be beneficial to only have to run the hook once. Signed-off-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 894a9d3 commit c0fc686

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Documentation/githooks.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,40 @@ This hook is invoked by 'git gc --auto'. It takes no parameter, and
317317
exiting with non-zero status from this script causes the 'git gc --auto'
318318
to abort.
319319

320+
post-rewrite
321+
~~~~~~~~~~~~
322+
323+
This hook is invoked by commands that rewrite commits (`git commit
324+
--amend`, 'git-rebase'; currently 'git-filter-branch' does 'not' call
325+
it!). Its first argument denotes the command it was invoked by:
326+
currently one of `amend` or `rebase`. Further command-dependent
327+
arguments may be passed in the future.
328+
329+
The hook receives a list of the rewritten commits on stdin, in the
330+
format
331+
332+
<old-sha1> SP <new-sha1> [ SP <extra-info> ] LF
333+
334+
The 'extra-info' is again command-dependent. If it is empty, the
335+
preceding SP is also omitted. Currently, no commands pass any
336+
'extra-info'.
337+
338+
The following command-specific comments apply:
339+
340+
rebase::
341+
For the 'squash' and 'fixup' operation, all commits that were
342+
squashed are listed as being rewritten to the squashed commit.
343+
This means that there will be several lines sharing the same
344+
'new-sha1'.
345+
+
346+
The commits are guaranteed to be listed in the order that they were
347+
processed by rebase.
348+
349+
There is no default 'post-rewrite' hook, but see the
350+
`post-receive-copy-notes` script in `contrib/hooks` for an example
351+
that copies your git-notes to the rewritten commits.
352+
353+
320354
GIT
321355
---
322356
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)