The :/
syntaxallows you to match commits using regular expressions. E.g., to create a fixup commit for an earlier commit that contains the string 'Add widget', you can write:
git commit --fixup ':/Add widget'
Is there way to apply modifiers such as ^
or ~
to the :/
expression? I've tried the obvious syntax...
git show ':/Add widget^'
Which doesn't work:
fatal: ambiguous argument ':/widget^': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
(And git show ':/Add widget^' --
results in fatal: bad revision ':/Add widget^'
).
Use the anchored search, '@^{/Add widget}^'
or do the substitution yourself with $(git rev-parse :/Add\ widget)^