git get previous revision number
I'm trying to get short stats be开发者_JS百科tween two git revisions (the current one with the previous one) I have the following command
git diff --shortstat -b -w <SHA1 of starting commit>..<SHA1 of ending commit>
How can I elegantly and automatically specify the ending commit as the direct previous one to the starting commit I specifoed?
If you append a ^
to a commit, you can get its parent:
$ git show HEAD^ # Show parent of latest commit
$ git show 9dd206a^ # Show parent of 9dd206a
The gitrevisions man page has a lot more details on all the different ways to specify commits.
Try git diff --shortstat -b -w HEAD^
精彩评论