Skip to content

Instantly share code, notes, and snippets.

@spkellydev
Created July 17, 2019 21:40
Show Gist options
  • Save spkellydev/43ecf0456e5f4e576dcbedace91f3be2 to your computer and use it in GitHub Desktop.
Save spkellydev/43ecf0456e5f4e576dcbedace91f3be2 to your computer and use it in GitHub Desktop.
Function to get to the first commit PAGE of any github repo.
// copy and paste into devtools, press enter. voila
function githubFirstCommitsPage() {
let el = document.querySelector('.repository-content');
let base = el.querySelector('a[data-pjax]').href;
let count = el.querySelector('.commits .num')
.textContent
.trim()
.replace(/[^\d\.\-]/g, "");
count = count-36;
let sha = el.querySelector('.commit-tease-sha')
.href
.split('/');
sha = sha[sha.length-1];
window.location = `${base}?after=${sha}+${count}`;
}
githubFirstCommitsPage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment