My colleague pointed out lately, that SVN refers to its commits with unique numbers. If I want to refer to a commit in Git, I know that I just have to copy a few of the SHA’s digits, but even if a project has some thousands of commits, an increasing number would be easier to remember or even type.
开发者_如何学CIs it possible to let Git list its commits like this?
0001 a258cb5 Latest commit
0002 373a4e2 previous one
0003 00f7c33 ...
0004 0bbc4da ...
0005 5b7eb09 ...
That way, you could refer to a commit with something like HEAD~2
instead of 00f7c33
. Of course the number would change for every commit that is done, but I rarely refer to older commits, so the numbers would never be very large and easy to remember.
In git this does not make sense, as the commits are not really ordered. You can apply some changes from elsewhere and then forward merge others. I guess this applies to any distributed version control software.
Unless you manage your own list generated from the history, I'm afraid it's not possible.
If you look for a more readable way of uniquely identifying a change (not a number but some string that is human friendly), you can use the output of git describe
.
The format is:
last tag - # of commits since tag - g.id
精彩评论