开发者

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^

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜