git log

git --help log可以查看git log的完整帮助


git log --oneline

git log --date=short --pretty=format:"%h %cd %s"


# 查看某文件的修改历史

1.cd $filedir文件所在路径

2.git log $filenamegit log + 文件名(搭配辅助参数)


# 创建别名alias

$ vi ~/.gitconfig

[ alias ]
logl = log --oneline
logg = log --graph --date=short --pretty=format:'%C(yellow)%h%Creset %Cred%cd%Creset %Cgreen%s%Creset' --abbrev-commit
测试:

$ git logg pthread.c



附录

这部分可以用help详细查看。

--date=(relative|local|default|iso|rfc|short|raw)
   --date=relative shows dates relative to the current time, e.g. "2 hours ago". 

   --date=local is an alias for --date=default-local.

   --date=iso (or --date=iso8601) shows timestamps in a ISO 8601-like format. 

   --date=iso-strict (or --date=iso8601-strict) shows timestamps in strict ISO 8601 format.

   --date=rfc (or --date=rfc2822) shows timestamps in RFC 2822 format, often found in email messages.

   --date=short shows only the date, but not the time, in YYYY-MM-DD format.

   --date=raw shows the date in the internal raw Git format %s %z format.

   --date=format:...  feeds the format ...  to your system strftime. Use --date=format:%c to show the date in your system locale's preferred format. See the strftime manual for a complete list of format placeholders. When using -local, the correct syntax is
   
   --date=format-local:....
   --date=default is the default format, and is similar to --date=rfc2822


选项	 说明
%H	提交对象(commit)的完整哈希字串
%h	提交对象的简短哈希字串
%T	树对象(tree)的完整哈希字串
%t	树对象的简短哈希字串
%P	父对象(parent)的完整哈希字串
%p	父对象的简短哈希字串
%an	作者(author)的名字
%ae	作者的电子邮件地址
%ad	作者修订日期(可以用 -date= 选项定制格式)
%ar	作者修订日期,按多久以前的方式显示
%cn	提交者(committer)的名字
%ce	提交者的电子邮件地址
%cd	提交日期
%cr	提交日期,按多久以前的方式显示
%s	提交说明
%Cred	switch color to red
%Cgreen	switch color to green
%Cblue	switch color to blue
%Creset	reset color
%C(...)	color specification, as described in color.branch.* config option; 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值