0

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)

user3472065
  • 1,259
  • 4
  • 16
  • 32

1 Answers1

0

If you're specifically trying to look for non-merge-commits, you can use:

git log -n 5 --no-merges

This will, of course, also skip merge commits that don't contain "Merge branch" in their log message.

ComputerDruid
  • 16,897
  • 1
  • 19
  • 28