Skip to content

Instantly share code, notes, and snippets.

@DV8FromTheWorld
Last active July 29, 2024 14:26
Show Gist options
  • Save DV8FromTheWorld/928caef2c92ad089ffb41e404bd4b510 to your computer and use it in GitHub Desktop.
Save DV8FromTheWorld/928caef2c92ad089ffb41e404bd4b510 to your computer and use it in GitHub Desktop.
JS Bookmark to move from a blob branch to the main trunk of git repo on github.
;(() => {
const url = location.href;
if (!url.includes('github.com/discord/discord')) {
alert("Not on github.com/discord/discord. Not prepared to move to main branch");
return;
}
if (!url.includes("blob/")) {
alert("Not on a git blob/ path.");
return;
}
const updatedUrl = url.replace(/blob\/.*?\//, "tree/main/");
location.href = updatedUrl;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment