Posted over 8 years ago. Visible to the public.

Git: In an (interactive) rebase, find out which commit you are currently working on (until version <

The following stopped working with git version or higher

When you are using git rebase and are currently editing a commit (due to a conflict, for example), you may want to know the current commit. [1]\
Luckily, there is lots of useful stuff in the .git directory.

Commit hash that you are currently applying

cat .git/rebase-merge/stopped-sha

Useful if you want to inspect the original commit for its changes, for example like:

git show `cat .git/rebase-merge/stopped-sha`

Current commit's message

cat .git/rebase-merge/message

In case you forgot what the changes are supposed to do.

Remaining rebase task list

cat .git/rebase-merge/git-rebase-todo

All commits that will be applied after the current one (and their "strategy", e.g. pick, squash, ...)

Hash of the target commit/branch that your (entire) rebase is applied to

cat .git/rebase-merge/onto

Handy when you want to look at that branch's state of the file.

[1] While git shows the commit when stopping at conflicts, for example, that information may have scrolled off your terminal's buffer or you might be working in another terminal. Or maybe you are just too lazy to scroll up.

Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Arne Hartherz
Last edit:
over 7 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more