Determining a fork status?

Have been using the bootstrap theme at GitHub - razonyang/hugo-theme-bootstrap: A fast, responsive and feature-rich Hugo theme for personal blog and documentations.

I like it but wanted to find a fork of it that is single language and no npm. The forks are shown at Forks · razonyang/hugo-theme-bootstrap · GitHub , however there is no indication of the fork status. For example if I click on GitHub - TrendingTechnology/hugo-theme-bootstrap: An extreme fast, responsive and feature-rich Hugo theme. 一个极快、响应式和功能丰富的 Hugo 主题。 it states "This branch is 740 commits behind razonyang:master. "

Is there a (Git or Github function/feature) to determine a fork status, without searching through 89 forks ?

Hiya. :wave:

“Fork status” is a new concept for me, so I’m asking to clarify and to educate myself: is “fork status” how many commits apart it is from the current, original repo? Please let me know! :slight_smile:

1 Like

@maiki - yes, I think it is the number of commits apart from the current. I’m just reading through the post at How to determine which forks on GitHub are ahead? - Stack Overflow . Unfortunately the ‘Insights’ / “Forks” solution doesn’t work for me. Possibly the level of detail that is displayed is controlled by the source/author on Github ?

Here’s a thing:

I increased the text size and took the screenshot, hopefully that will help ya out somewhat.

I was able to do that because of the bookmarklet solution provided at: How to determine which forks on GitHub are ahead? - Stack Overflow

It’s pretty nifty! I used Firefox to run it. Hope that helps you figure out the fork you are looking for. :slight_smile:


@maiki - thanks, I was also up to adding the bookmarklet, but cannot get it to paste into Firefox ??

1 Like

@maiki - Can you please advise how you were able to get the JS running in Firefox. I tried the Browser console, etc, tried the instructions from Firefox about having a bookmarklet, but couldn’t drag the code in ??

Sure. Here is a screenshot of my bookmark:

When I added a new bookmark, I added the javascript to the URL field. So:

javascript:(async () => {
  /* while on the forks page, collect all the hrefs and pop off the first one (original repo) */
  const aTags = [...document.querySelectorAll('div.repo a:last-of-type')].slice(1);

  for (const aTag of aTags) {
    /* fetch the forked repo as html, search for the "This branch is [n commits ahead,] [m commits behind]", print it directly onto the web page */
    await fetch(aTag.href)
      .then(x => x.text())
      .then(html => aTag.outerHTML += `${html.match(/This branch is.*/).pop().replace('This branch is', '').replace(/([0-9]+ commits? ahead)/, '<font color="#0c0">$1</font>').replace(/([0-9]+ commits? behind)/, '<font color="red">$1</font>')}` + " <a " + `${html.match(/href="[^"]*\.zip">/).pop() + "Download ZIP</a>"}`)

That code goes into the URL field when adding a bookmark:

Once you’ve saved your bookmark, go to the Forks page of your choice (Forks · razonyang/hugo-theme-bootstrap · GitHub) and use the bookmarklet; in this case it will begin populating the page with those additional values showing on the page. :slight_smile:

I’m using Firefox from Flatpak.

1 Like

@maiki - Oh wow, thank you. That worked perfectly. Screendump shows the first part of the output

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.