What I want is:
given a start commit p
,
do the following:
开发者_运维问答git show p
and if finished reading and then press ENTER
,automatically show the previous commit.
Until I press ctrl-c to terminate .
Is there a tool to do this?
$ git log --format=%h $commit | while read hash; do git show $hash; echo -n Press enter to continue; read dummy; done
Not exactly what you want, but the following is quite straight forward since <commit>~n
designates the nth ancestor from a commit:
$ git checkout p
read...
$ git checkout p~1
read...
$ git checkout p~2
etc.
A small scripting effort will lead to the behavior you describe, though.
Not quite what you're asking for, but there's a git command to play back the commit history of a given file: git playback
精彩评论