Put this in an executable file named "pager":
#! /usr/bin/env bash
TEMP=/tmp/file-$$.txt
trap "rm -f $TEMP" EXIT HUP INT TERM
echo '-*- outline -*-' > $TEMP
cat "$@" >> $TEMP
emacs $TEMP 0<&1
The initial line of the temporary text file arranges for emacs to enter outline mode. Then `cat` appends the zero-or-more specified file(s). Finally the editor allows viewing the input text via your favorite mode, then `trap EXIT` cleans the temp file.
Zero files implies reading from stdin.
Ordinarily `git log | pager` would not be well supported, as the pipe can interfere with stdin connected to keyboard. (Diagnostic in that case is: "emacs: standard input is not a tty".) We expect that stdout will be connected to terminal, that is, `pager` is at the end of the pipeline. Given that, `0<&1` is able to recover from the situation by connecting stdin to the same terminal pty that stdout is connected to, allowing for a successful edit session.