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.
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`
cat .git/rebase-merge/message
In case you forgot what the changes are supposed to do.
cat .git/rebase-merge/git-rebase-todo
All commits that will be applied after the current one (and their "strategy", e.g. pick
, squash
, ...)
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.