Skip to content

Instantly share code, notes, and snippets.

@agamm
Last active May 28, 2026 10:38
Show Gist options
  • Select an option

  • Save agamm/ea65f0510e65e67f65eca189d55ee32b to your computer and use it in GitHub Desktop.

Select an option

Save agamm/ea65f0510e65e67f65eca189d55ee32b to your computer and use it in GitHub Desktop.
Show all resolved comments in a Github Pull Request

Run this in the console:

document.querySelectorAll('span.Details-content--closed').forEach((e)=>{e.click()})

From the creator of: unzip.dev πŸš€

@rxaviers

rxaviers commented Jun 9, 2020

Copy link
Copy Markdown

New code:

document.querySelectorAll('details.outdated-comment').forEach((e)=>{e.setAttribute("open", true)})

@stephencarr

Copy link
Copy Markdown

Newer code:

document.querySelectorAll('.js-resolvable-thread-contents').forEach((e)=>{e.classList.remove("d-none")})

@Kevin-Mok

Copy link
Copy Markdown

Original worked for me, but the other 2 didn't.

@meeque

meeque commented Mar 25, 2021

Copy link
Copy Markdown

Great stuff, very helpful. However, when the comments get too plenty, Github hides some of them. Try this before:

document.querySelector('button.ajax-pagination-btn').click()

You may need to run that multiple times until Github shows all. Can try to automate further, if anyone is interested?

@bmatzelle

Copy link
Copy Markdown

None of those above worked for me for some reason. Try this one, which works for me:

document.querySelectorAll('.js-resolvable-timeline-thread-container').forEach(e => { e.setAttribute('open', '') })

@kemalizing

Copy link
Copy Markdown

Thanks a lot guys.
In different pages different codes worked for me:

in files changed tab, this worked:
document.querySelectorAll('.js-resolvable-thread-contents').forEach((e)=>{e.classList.remove("d-none")})

in conversation tab, this worked:
document.querySelectorAll('.js-resolvable-timeline-thread-container').forEach(e => { e.setAttribute('open', '') });

Anyways, it would be great if @github added a button or an option for this!

@maelvls

maelvls commented Jul 1, 2021

Copy link
Copy Markdown

Update 22 May 2026: seems like GitHub has removed option + click on "Show resolved" back in April 2026 (https://gist.github.com/agamm/ea65f0510e65e67f65eca189d55ee32b?permalink_comment_id=6112200#gistcomment-6112200). I guess we are back to the bookmark trick below.

Update 24 July 2024: The best way to expand all comments at once is to use the GitHub's official Option+click on "Show resolved". This trick was brought up by @amonsosanz in this comment.

Before Option+click existed, we used to create a Chrome or Edge bookmark with the following javascript snippet. It would load the hidden items on large PRs and then unfold the resolved comments (source):

  1. Add a bookmark (show bookmarks with Ctrl+Shift+B on Windows and ⌘-Shift-B on macOS)
  2. In the URL field, copy-paste this:
    javascript:function loadAllCommentsAndShowResolved(){let e=!1;Array.from(document.querySelectorAll("button, .btn-link.Details-content--closed")).forEach(o=>{o.classList.contains("ajax-pagination-btn")?o.hasAttribute("disabled")||"Load more…"!==o.innerText?o.hasAttribute("disabled")&&"Loading…"===o.innerText?(console.log("waiting",o),e=!0):console.log("unrecognized 'Load more' button",o):(console.log("found",o),e=!0,o.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))):o.classList.contains("Details-content--closed")&&"Show resolved"===o.innerText&&o.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0}))}),e?setTimeout(loadAllCommentsAndShowResolved,200):console.log("all comments loaded")}loadAllCommentsAndShowResolved();

A simpler version that doesn't load the hidden items on large PRs:

  1. Add a bookmark (show bookmarks with Ctrl+Shift+B on Windows and ⌘-Shift-B on macOS)
  2. In the URL field, copy-paste this:
    javascript:document.querySelectorAll('.js-resolvable-timeline-thread-container').forEach(e => { e.setAttribute('open', '') })()

@spidiweb

spidiweb commented Nov 17, 2021

Copy link
Copy Markdown

All of the above will not work when we have too many conversations.

For me, there was a PR having more than 120 comments, so first I had to get all the hidden items loaded, then expension of resolved comments needs to be done. For the same, I have written below script:

let isActiveExpension = false;
let interval = setInterval(()=>{
isActiveExpension = true;
const elements = document.querySelectorAll("button[type=submit].ajax-pagination-btn"); if(elements.length === 0){
    console.log("All sections are expanded");
    clearInterval(interval);
    isActiveExpension = false;
    expandSubSections();
    setTimeout(expandSubSections, 10000)
}
else{
    console.log("Expanding sections");
    elements[0].click();
    expandSubSections();
}
},10000);

function expandSubSections()
{
    console.log("Expanding sub-sections");
    document.querySelectorAll(".btn-link.text-gray.f6.Details-content--closed").forEach((element)=>{element.click();});
}

However, above too does not works as it seems like github is using some optimizations to load limited HTML at a time to keep page light.

So, to resolve this issue, we may have to add some scroll script too to above one, which I'll do after some time.

Note: This script worked on my company's enterprise github, I haven't tried the same on public git.

@ardfar68

Copy link
Copy Markdown

to Unfold all Resolved conversation I use below and it works fine:
javascript:document.querySelectorAll('.js-resolvable-timeline-thread-container').forEach(e => { e.setAttribute('open', '') })()

What code should I use to Fold them again ?
thanks

@kemalizing

kemalizing commented May 12, 2022

Copy link
Copy Markdown

What code should I use to Fold them again ? thanks

just refresh?

@amonsosanz

Copy link
Copy Markdown

You can use Alt + Click on one comment to fold/unfold them all.

@jeanjackson-lp

Copy link
Copy Markdown

^ What @amonsosanz said worked for me. On Mac, that would be option + click

@mccataldo

Copy link
Copy Markdown

Thanks, @amonsosanz! πŸŽ‰

@qmcree

qmcree commented Jul 24, 2023

Copy link
Copy Markdown

Whoa, game changer. On Mac Chrome, Option + Click on one comment's "Show resolved" link shows all for me. Thanks @amonsosanz!

@Rasukarusan

Copy link
Copy Markdown

Thanks, @amonsosanz! πŸŽ‰

ghost commented Apr 12, 2025

Copy link
Copy Markdown

Thank you @amonsosanz!

@YenHub

YenHub commented Dec 8, 2025

Copy link
Copy Markdown

Neat trick, @qmcree! 🀝

@jscrui

jscrui commented Apr 21, 2026

Copy link
Copy Markdown

it doesn't work for me! option + click on the top right: show resolved.

@Sunasuna24

Sunasuna24 commented Apr 22, 2026

Copy link
Copy Markdown

option + click on Pull Request "show resolved" used to work for me, but recently it stopped working :(

@maelvls

maelvls commented May 22, 2026

Copy link
Copy Markdown

Same, option + click seems to be gone.

@alexisdouheret

Copy link
Copy Markdown

indeed alt + click doesn't work anymore

@mhsmith

mhsmith commented May 28, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment