Posted almost 10 years ago. Visible to the public. Deprecated.

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.

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Arne Hartherz
Last edit:
about 1 year ago
by Niklas Hasselmeyer
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