Git: Log (filtering)

The Log command has options that you can filter the commit history, so it helps you to work on the project more efficiently with your team members. You can search the specific commit history by author, date, message, code, and file.

By author

$ git log --author="Grace"

image.png

By date

$ git log --before="2020-12-20"

$ git log --after="2020-12-20"

By commit message

$ git log --grep="[message]"

$ git log --grep="login"

image.png

By file

git log [filename]

git log script.js

image.png

By code

git log -S "[code]"

git log -S "src" image.png I added 'src' code in this commit

You can see more information on Git's official site.

As a junior web developer, one of my goals is to become a better person every day. That is why I decided to write about the coding that I know and learn. It might be very simple and easy for some people, but I celebrate every small step (which motivates me), so I try to do it every day! You are welcome to give feedback to my posting!

Comments (2)

Margaret Goldman's photo

This is very helpful. Thank you Grace Jeong.

Haeun Grace Jeong's photo

I am glad this can be helpful. Thank you :)