[edit] If you want to spot what commits have been cherry-picked from A
to B
, try :
git log --graph --oneline --boundaries --cherry-mark A...B # 3 dots
--cherry-mark
will flag commits that bring the same changes on both sides with an =
.
If you replace --cherry-mark
with --cherry-pick
, the matching commits will be completely hidden, and you can compare the messages of the remaining commits to see if they were replayed, but modified (to fix a conflict for example).
[original answer]
a. write a function (or a script) which turns an input string, with special characters, into its escaped form
e.g : turns \ . [ ] * ^ $
into \\ \. \[ \] \* \^ \$
(I may be forgetting some other special chars)
and use it in your git log
command :
# example for single line patterns :
rescape () { echo "$1" | sed -e 's/\([\^\[$.*]\)/\\\1/g' -e 's/]/\\]/g'; }
git log --grep "^$(rescape 'I can grep * and . and [ and ] !')$"
b. (technically not exact, but should work in most cases) if you want a quick way to manually type the message, replace any special char with .
:
# instead of grepping for :
^[1234] expand . to *$
# grep for :
^.1234. expand . to .$