For one thing, there is a ORIG_HEAD in place during a rebase (but that is not limited to the rebase command)
But you can also look at the 2010 Git 1.7.0 git-rebase.sh script itself (which is as "internal" as you can get ;) ).
Lines like those can give you another clue:
dotest="$GIT_DIR"/rebase-merge
test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply || die "No rebase in progress?"
sabgenton comments:
- The folder
rebase-apply seems to appear with rebase,
- but a folder
rebase-merge shows up only with with rebase -i.
And hippy also comments, in 2017, that:
The coding guidelines discourage the usage of -o (see Documentation/CodingGuidelines), so the correct way now (2017, but also since 2011, Git 1.7.6) is:
(test -d ".git/rebase-merge" || test -d ".git/rebase-apply") || die "No rebase in progress?"
Jelaby suggests in the comments:
(test -d "$(git rev-parse --git-path rebase-merge)" || \
test -d "$(git rev-parse --git-path rebase-apply)" )
This correctly handles worktrees and unusual or non-standard layouts that don't have a .git directory, and also allows you to run this test from a subdir of the working directory.
That is because the git rev-parse --git-path <path>: does resolve "$GIT_DIR/<path>".
Git 2.6+ (Q3 2015) will print more information during a rebase:
See commit 592e412, commit 84e6fb9 (06 Jul 2015), commit 84e6fb9 (06 Jul 2015), and commit df25e94, commit 05eb563 (30 Jun 2015) by Guillaume Pagès (gitster).
(Merged by Junio C Hamano -- gitster -- in commit 178d2c7, 03 Aug 2015)
status: give more information during rebase -i
git status gives more information during rebase -i, about the list of commands that are done during the rebase.
It displays:
- the last two commands executed and
- the next two lines to be executed.
It also gives hints to find the whole files in .git directory.