How to find the log I want when using 'git log'

来源:互联网 发布:淘宝抢购需要刷新页面 编辑:程序博客网 时间:2024/06/08 01:49

Usually we use the * git log* without any parameters,just like:

git log##or make the number of the log that need to be showgit 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 modificationgit 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 loggit log --pretty=oneline -10#show part of the loggit 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' logsgit 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
原创粉丝点击