A Relaxing Coding Break: Blog Cleanup and A Useful GitHub Bookmarklet!
- published: October 22, 2025 estimate: 4 min read view-cnt: 0 views
I am taking a break from hardcore writing. I’ve been typing more and more words each day. I just need a restful coding experience to relax my stressful mind a bit 😌
Clean Up The Repository
I moved markdown files from this blog repository to another content repository.
The advantage is to keep future commits in this repository clean.
Plus, anyone who wants to clone my repository won’t need an extra step to delete all the content files.
Though, the existing commit history is still messy. But, Hey! Let’s call it a day.
(I don’t think my repository is promising enough for someone to clone it 🤣🤣)
This is the prompt I used that led me to the solution, in case someone might be interested:
I am using Astro.js to generate my blog, and then, publish it to GitHub Pages.
For now, I use purely markdown files stored in a folder, and then use the content collection API to pull them out.
All the files live inside the same repository, hence, every visitor on the internet could either go to my website to view the posts, or go to the GitHub repository page, view those files directly.
I wonder if it is possible to separate markdown files from my repository?
The reason is that I want to keep the repository clean, people who wish to use my template, can just clone the repository without the actual blog posts.
Could you provide a few options to solve this problem?
Finding Timestamp of The First Commit
Ever wonder when a repository was first created and committed by the author?
I felt that learning about the history and metadata of an entity helps me appreciate the artifact more.
Besides checking the star numbers and commit history, I also try to find interviews with the creator on podcasts.
All this little information just helps me want to invest more time on the tool. (Call me a believer)
However, I found out the current GitHub UI isn’t very friendly for getting the timestamp I want
For now, you have these options:
- Simply clicking the next page until you hit the last page (35 items per page. For a 7000 commits repo, you need to click 199 times)
- Click on the “Insights” tab, and then, click “Contributors”. The problem is that this method is not so responsive for an active repository.
- Clone the repo, and then use a git command to pull out the information.
That’s to say, none of these options is ideal. I don’t want to clone the entire repo just to check one timestamp. I just want the result to pop up like a normal link, no latency just a click.
Then, I found out this Stack Overflow discussion and this GitHub repository
The method is simply modifying the query string of the URL, and then making a bookmarklet to trigger it effortlessly.
However, the method used in the repository doesn’t work for me. So, I built my own version in a few minutes:
const hash=document.querySelector('div[data-testid="latest-commit-details"] a').href.split('/').pop();
const cmtListBtn=document.querySelector('h2[data-testid="screen-reader-heading"]+a');
const cmtCnt=Number.parseInt(cmtListBtn.innerText.replaceAll(',',''));
const dest=`${cmtListBtn.href}?after=${hash}+${cmtCnt-10}`;
window.location = dest;
While browsing on the home page of a repository, paste this script into the devtools console.
Then, you will be redirected to the commit history page containing the first commit.
Here’s the bookmarklet version, shout out to the Web Tool for easy creation:
Drag it to your bookmarks bar —> The Bookmarklet
Now, you can start to believe 😎
Footnote: While this isn’t perfect (some browsers block bookmarklets, as mentioned here), it works well for my setup and is much faster than clicking through pages.
End Of The Resting Day
Making some QOL improvements is just the right way to ease our stressful mind. I do have plenty of options other than coding.
However, it is just delightful to remove some tiny inconvenience without putting in too much effort.
Plus, sometimes a hands-on coding experience is just satisfying.
(p.s. I coded the javascript snippet manually without using any AI tool)
I think the habit of tinkering with the browsing experience started ever since I learned Tampermonkey and data: URLs
(see javascript: URLs if you want to learn more about bookmarklet)
After this powerful charge, I am ready for the intensive writing challenge 💪💪
See you in the next one!
No comments yet
Be the first to comment!