When doing a git tag, I’m not always great at remembering if HEAD~6 (for example) is inclusive or exclusive.
Given that most of my commits are prefixed with an issue number, I wondered if there is some magic command for searching for the commit SHA from part of its message.
I know it’s easy to do a git log and work from there, but I want more easy 🙂
EDIT : Someone also asked the opposite question: In Git, is there a way to get the “friendly” name for an arbitrary commit?
You can use
:/blahsyntax to specify a commit whose commit message starts with the given text.E.g.
This is valid anywhere a commit can be used. E.g.
If you actually need the SHA-1 of the commit you can just use rev-parse.
See the “SPECIFYING REVISIONS” section of the git rev-parse man page: