我最近偶然在CVS一个很酷的功能,你可以命名日期修改,如:其他存储库系统有哪些cvs的-D(日期)选项?
# List changes made between the latest revision 24 hours ago and now
cvs diff -D "1 day ago"
做任何其他仓库系统(例如的Git,SVN,大巴扎,水银等)有这样一个选项这个?
我最近偶然在CVS一个很酷的功能,你可以命名日期修改,如:其他存储库系统有哪些cvs的-D(日期)选项?
# List changes made between the latest revision 24 hours ago and now
cvs diff -D "1 day ago"
做任何其他仓库系统(例如的Git,SVN,大巴扎,水银等)有这样一个选项这个?
Mercurial具有多种日期格式:http://www.selenic.com/mercurial/hg.1.html#date-formats,但可能不是“1天前”。
This subversion bug report表明,Subversion不能做到这一点本身,但确实提供了使用date
做一个提示:
(2)虽然颠覆不明白-r“{3天前} “,日期可以帮助 :-r”{
date -Is -d '3 days ago'
}“。
Subversion有一个类似的功能。例如:
svn diff -r {2010-07-31}
的语法在http://svnbook.red-bean.com/en/1.5/svn.tour.revs.specifiers.html#svn.tour.revs.dates
解释(回答我的问题)
git的日志之前或给定时间后支持过滤日期。例如:
git log --after='july 17 2010' --before='july 31 2010'
这里有一个shell脚本,使得它更容易一些,列出提交的范围内,但它也使用了比git的日志的默认一个更简洁的格式:
#!/bin/sh
# git-changes
FORMAT='%cd%x09%h%n%x09%s%n'
CMD="git log --format=format:$FORMAT"
case $# in
0)
$CMD ;;
1)
$CMD "--after=`date -d "$1"`" ;;
2)
$CMD "--after=`date -d "$1"`" --before="`date -d "$2"`";;
esac
注:我包裹的日期参数与日期命令,因为git把'July 17'
从'July 17 2010'
几个小时关闭出于某种原因。
用法:git-changes 'jul 17' 'aug 1'
git-changes # Same as git log, but more terse
git-changes 'yesterday' # List all commits from 24 hours ago to now
git-changes 'jul 17' 'aug 1' # List all commits after July 17 at midnight
# and before August 1 at midnight.
输出示例:
Sat Jul 31 23:43:47 2010 -0400 86a6727
* Moved libcurl into project directory as static lib.
Sat Jul 31 20:04:24 2010 -0400 3a4eb10
* Added configuration file support.
Sat Jul 31 17:44:53 2010 -0400 aa2046b
* Fixed truncation bug in bit parser.
Sat Jul 17 00:10:57 2010 -0400 99e8124
* Added support for more bits.
现在,看到介绍的所有更改提交99e8124,类型git show 99e8124
。要查看自修订版99e8124以来的所有更改(不包括该提交本身),请键入git diff 99e8124
。