Get commit according to time or view git log


View the log after a certain point in time

git log --since="Fri Aug 10 19:16:10 2012 +0800"

or use --until to view the log before a certain point in time

git log --before="Fri Aug 10 19:16:10 2012 +0800"

Get the commit after a certain point in time, -n 1 means to return only one, the most recent one

git rev-list -n 2 --since="Fri Aug 10 19:16:10 2012 +0800" yourbranch

to get the commit before a certain point in time, -n 1 means to return only one, the latest youbranch is the corresponding branch name

git rev-list -n 2 --before="Fri Aug 10 19:16:10 2012 +0800" yourbranch

syncs code before a point in time, which can be used to retroactively verify problems

repo forall -c "git checkout `git rev-list -n 1 --before=\"Fri Jun 29 15:53:40 2012 + 0800\" yourbranch`"

from: http://www.yinqisen.cn/blog-105.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326589900&siteId=291194637