The following stopped working with git version 1.7.9.5 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.