Usually we use the * git log* without any parameters,just like:
git log
##or make the number of the log that need to be show
git log -3
But sometimes I just want to search some specific logs I want.So how can I attach my goal?Add the parameters you need!
- If you want to search the log with a specific person,using –author:
git log --author=xxx
- If you want to show the modification history,using -p:
#show the lastest 2 log and the commit modification
git log -p -2
- If you want to show many logs and just need to know part of the information for every log,using –pretty,the value can be oneline,short,full,fuller,which means the amount of the information you want to display.
#show oneline for every log
git log --pretty=oneline -10
#show part of the log
git log --pretty=short -10
- show the add/modify/delete file list,using –name-status:
- If you want to show the logs after a time node,using –since or –after:
##show the last 2 weeks' logs
git log --since=2,weeks
- If you want to show the logs before a time node,using –until or –before:
git log --before=2,weeks
- If you want to search the key word of the log,using –grep:
git log --grep=xxx