GIT LOG: How do I search for a commit through a specific message?

Asked

Viewed 283 times

6

I wonder if there’s any way to use the git log to list commits, filtering through a specific message.

Example:

git commit -am "Correção do ícone de exclusão na listagem de usuários"

In the above case, I would like to apply a git log and see only the list of commits that had the word "user".

It is possible to do this?

  • Related: https://answall.com/questions/323641/achar-substring-em-mensagens-de-commits-recent

1 answer

8


Of git log documentation we can see the parameters:

  • --all: Lists commits from all branches, not just what you are.
  • --grep=<pattern> to restrict the search to commits whose log message contains the Pattern displayed. This Pattern follows the same regular expression rules as the grep command.

As in your case you only want commits that contain a word, the command is:

git log --all --grep='usuário'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.