Operations 6 min read

Master GitHub Pages & Code Sharing Tricks: From Branch Deployment to Issue Automation

This guide explains how to use the master branch as a GitHub Pages source, share specific code lines via URL fragments, automatically close issues with commit keywords, embed GitHub buttons, set project language with .gitattributes, view traffic analytics, explore trending repos, and discover handy shortcuts.

Programmer DD
Programmer DD
Programmer DD
Master GitHub Pages & Code Sharing Tricks: From Branch Deployment to Issue Automation

GitHub Pages is commonly set up by creating a gh-pages branch, but syncing changes from master can be painful. GitHub now allows using the master branch as the site source.

After selecting master, any commit to master automatically updates the website.

Precise code line sharing

You can link directly to a specific line or range in a file by appending #L<line> or #L<start>-L<end> to the URL, e.g.,

https://github.com/AlloyTeam/AlloyTouch/blob/master/alloy_touch.js#L240

or #L39-L45. The generated URL jumps to and highlights the specified lines.

Auto‑close issues via commit messages

Including keywords such as fix, close, closes, closed, fixes, fixed, resolve, resolves, resolved followed by an issue URL in a commit message will automatically close that issue.

fix https://github.com/AlloyTeam/AlloyTouch/issues/6

Embedding GitHub with HTML

Insert an <iframe> with the appropriate user and repo parameters to display a GitHub button.

<iframe src="//ghbtns.com/github-btn.html?user=alloyteam&repo=alloytouch&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>

Setting project language with .gitattributes

Add a .gitattributes file containing *.html linguist-language=JavaScript to force HTML files to be recognized as JavaScript.

*.html linguist-language=JavaScript

Viewing project traffic data

In the repository, go to Graphs → Traffic to see Referring sites and Popular content statistics.

Trending repositories

Use URLs like https://github.com/trending/javascript?since=daily to view daily trending lists for specific languages (e.g., JavaScript, HTML, CSS). The GitHub Explore page also provides curated recommendations.

Other handy shortcuts

Type “:” in an issue to insert an emoji.

Press Shift + ? to show keyboard shortcuts.

Press R on selected text in an issue to quote it quickly.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

GitHubcode sharingGitHub Pagestraffic analyticsissue automationgitattributes
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.