go to a specific commit number not id on github

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

go to a specific commit number not id on github

Post by bernd »

how is it possible to jump to commit number 10000 or 99 or 1111 or even 1 on github?

bernd
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: go to a specific commit number not id on github

Post by wmayer »

In contrast to subversion which uses a consecutive number for its revisions git uses hash values. Since a hash value is not very useful for a user to decide if a certain version is older than another we apply a trick to achieve a consecutive number like in subversion by counting the number of commits:
git rev-list HEAD --count

Now to get the hash value of e.g. the 1111th commit you first must apply the above command to get the number of commits (e.g. 14795) and subtract 1111 from it (13684). With git log --skip=13684 you get the corresponding hash value git commit 73ee872301b1a51c
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

Thats cool werner :D

BTW: FYI because I don't mind ... github says it is commit 1088 https://github.com/FreeCAD/FreeCAD/tree/73ee872
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

But 14795-14793 = 2 not 1 github needs some coaching in simple math :mrgreen:
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: go to a specific commit number not id on github

Post by wmayer »

bernd wrote: Mon Sep 24, 2018 10:46 am Thats cool werner :D

BTW: FYI because I don't mind ... github says it is commit 1088 https://github.com/FreeCAD/FreeCAD/tree/73ee872
This is because at some point something got messed up in the history or so and thus we start from a certain reference commit:
see https://github.com/FreeCAD/FreeCAD/blob ... ev.py#L175

But nevertheless this is already a good start point for further investigations.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

or https://github.com/FreeCAD/FreeCAD/comm ... 396761+239 click on the commit and click on brows files. Github will show 14555 :)

Code: Select all

https://github.com/FreeCAD/FreeCAD/commits/master?after=8668296f9c7287827888d5f16acbfcaf1b396761+239
239 = 14795 - 14555 - 1
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: go to a specific commit number not id on github

Post by bernd »

or

240 = 14795 - 14555

Code: Select all

git log --skip=240 --oneline -1

Code: Select all

$ git log --skip=240 --oneline -1
7d8e53aaa add Const to ancestorsOfType
$ 
Post Reply