nolawi
nolawi

Reputation: 4649

How can I find the latest commit from forked repos on github?

For example I find a framework that is not maintained anymore but lots of forks. I want to see the more recent forks only. Network Graph is not available if its large.

enter image description here

Upvotes: 22

Views: 7899

Answers (4)

dearsina
dearsina

Reputation: 5220

I was looking for the same thing, and came across the following website that will list all forks, and latest commit date, stars, forks, issues, etc. A little annoying that GitHub themselves don't offer this (other than via commandline or their API).

https://techgaun.github.io/active-forks/index.html

Alternatively, you can use the following website:

https://gitpop2.vercel.app/

I am not affiliated with either.

Upvotes: 24

Zach Young
Zach Young

Reputation: 11223

I want to add, that in addition to just seeing all possible forks (with the default GitHub API sort of newest first), a JSON tool like jq can be used to show only forks with modifications.

There's a fast way, down below, by just comparing created_at and pushed_at as strings.

I also made a JQ script which allows you to say "how much newer" one date field is compared to another. It take an arbitrary number of seconds as a threshold to meet your definition of "modified":

getModifiedForks.jq:

# $ageThresholdInSeconds passed in from command-line, like `jq --arg ageThresholdInSeconds 10 -f <this-file>`
def selectOnlyModifiedForks:
    ((.updated_at | fromdate) - (.created_at | fromdate)) as $ageDiffInSeconds
    | select(
        $ageDiffInSeconds > ($ageThresholdInSeconds | tonumber)
    )
;

[
    .[]
    | selectOnlyModifiedForks
    | {
        html_url: .html_url,
        updated_at: .updated_at
    }
]
| sort_by(.updated_at)
| reverse

To see only repositories that were modified at least 2 days (172800 seconds) after the fork,

% curl -X GET https://api.github.com/repos/dedupeio/csvdedupe/forks
| jq --arg ageThresholdInSeconds 172800 -f getModifiedForks.jq
html_url created_at updated_at
https://github.com/rpatil524/csvdedupe 2019-11-15T01:38:35Z 2021-02-07T06:15:40Z
https://github.com/VirtualClarity/csvdedupe 2020-05-05T13:43:21Z 2020-05-08T22:41:00Z
https://github.com/DMells/csvdedupe 2019-02-12T08:08:37Z 2019-10-24T15:57:46Z
https://github.com/skyline-ai/csvdedupe 2019-03-28T08:21:51Z 2019-04-16T09:34:19Z

I piped the JSON output into csvkit for prettier viewing:

% <JSON-output> | in2csv -f json | csvlook

updated_at or pushed_at?

Considering @Carl G's comment:

Can you just use pushed_at > created_at?

curl -X GET 'https://api.github.com/repos/d-a-n/react-native-webbrowser/forks' \
| jq '[ .[] 
      | select(.pushed_at > .created_at) 
      | {html_url: .html_url, pushed_at: .pushed_at} ] 
      | sort_by(.pushed_at) 
      | reverse
     '

Yes, that's very quick and easy, thank you!

Link_to_fork created_at c_lt_p pushed_at
Mbompr 17-10-09T16:48:14 t 19-10-13T10:05:25
initz 18-05-08T13:01:10 t 18-05-08T13:08:51
thanhzusu 18-01-13T14:12:33 t 18-01-16T14:18:34
lambaosk8 18-01-12T04:15:06 t 18-01-13T11:26:20
jatinkatyal13 18-01-10T20:02:40 t 18-01-10T20:10:40
dnewcome 17-06-07T22:15:25 t 17-08-29T21:24:51
evenmatrix 17-07-18T15:15:19 t 17-07-18T15:40:14
matthewfbenjamin 17-01-24T01:09:33 t 17-01-24T14:54:27

As a caveat, there seems to be some confusion around which would represent "more freshness", updated_at or pushed_at.

Upvotes: 3

Till
Till

Reputation: 4523

You can do it with a curl:

curl -X GET https://api.github.com/repos/<owner>/<repo>/forks

For instance, the angular forks are:

curl -X GET https://api.github.com/repos/angular/angular/forks

You can add a sort parameter ?sort=<oldest|newest|stargazers>, but the default one is the newest.

Upvotes: 9

phd
phd

Reputation: 95028

Github API can list forks, and the default order is newest.

Upvotes: 3

Related Questions