I would like to take the latest 5 commits using git log that do not contain a specific string, for example "Merge branch".
I tried several options, but none of them worked. e.g.:
git log -n 5 --grep="Merge branch" --invert-grep
git log -n 5 -v --grep="Merge branch"
git log -n 5 --not --grep="Merge branch"
It seems that --invert-grep does the job but it doesn't work (http://git-scm.com/docs/git-log)
If you're specifically trying to look for non-merge-commits, you can use:
This will, of course, also skip merge commits that don't contain "Merge branch" in their log message.