GitHub 隐藏URL技巧 一、URL后缀技巧直接改末尾1..patch/.diff最常用对commit、PR、compare页面直接追加后缀返回原始文本diff可直接git apply打补丁。# 单次提交 https://github.com/xxx/yyy/commit/sha1.diff https://github.com/xxx/yyy/commit/sha1.patch # Pull Request https://github.com/xxx/yyy/pull/123.diff https://github.com/xxx/yyy/pull/123.patch # compare对比页面 https://github.com/xxx/yyy/compare/main...dev.diff https://github.com/xxx/yyy/compare/main...dev.patch.diff标准git diff格式.patch带commit元信息可直接git apply xxx.patch2..raw获取文件原始源码文件页面末尾改为/raw等价页面上的Raw按钮输出无渲染纯文本源码。原https://github.com/a/b/blob/main/test.py 改https://github.com/a/b/raw/main/test.py3..blame代码责任追溯https://github.com/a/b/blame/main/test.py绕过.git‑blame‑ignore‑revs忽略列表在commit sha后面加~/blame/sha~/test.py可以看到被屏蔽的提交记录。4. gist专属后缀# gist纯文本 https://gist.github.com/user/id.raw # gist可嵌入HTML页面 https://gist.github.com/user/id.pibb5..keys用户公钥页面用户主页后加.keys直接拿到该用户所有上传的SSH公钥安全审计常用。https://github.com/username.keys二、URL Query参数技巧?xxx1?w1忽略空白字符变更PR/files、commit diff页面过滤仅空格换行改动代码评审神器。https://github.com/xxx/yyy/pull/42/files?w1?tsN修改Tab显示宽度设置tab渲染为N个空格默认ts8常用?ts4。https://github.com/xxx/yyy/blob/main/file.go?ts4行号锚点#L10#L10‑L20点击行号自动生成精准定位单行/多行代码片段。https://github.com/xxx/yyy/blob/main/main.py#L12 https://github.com/xxx/yyy/blob/main/main.py#L12‑L24永久固定版本链接y快捷键普通blob链接会随分支变动按yURL切换为/blob/commit‑sha/xxx永久不变的固定快照链接permalink。三、域名替换黑魔法github.dev 网页版VS Code仓库页面把github.com→github.dev浏览器直接打开完整VS Code网页编辑器等价快捷键.英文句号。https://github.dev/user/repo快捷键仓库页面英文输入法直接按.一键跳转github.dev。github1s第三方非官方https://github1s.com/user/repo四、Compare高级对比URL语法分支/提交对比# A分支到B分支 https://github.com/user/repo/compare/main...feature # 跨fork对比别人仓库的分支 和自己仓库对比 https://github.com/my/repo/compare/otheruser:theirbranch...mybranch # 时间对比master一天前 vs 当前master https://github.com/user/repo/compare/master{1.day.ago}...master # 指定日期对比 https://github.com/user/repo/compare/master{2026‑01‑01}...master末尾追加.diff/.patch直接拿diff文本。五、网页端键盘快捷键仓库页面快捷键功能t快速文件搜索输入文件名跳转文件y切换为commit‑sha永久链接permalink.(句号)打开github.dev网页VSCodel快速跳转到行号s聚焦搜索框g i跳转到Issues页面g p跳转到Pull requests页面b切换分支选择框shift ←/→diff页面切换文件六、提交与Issue小技巧commit message写Fixes #123合并PR后自动关闭issue。评论中粘贴带#Lxx代码片段链接会自动渲染预览代码片段。七、安全审计场景实用组合拿用户SSH公钥https://github.com/{username}.keys批量获取提交补丁遍历commit url拼接.patch脚本批量下载分析历史泄露密钥。?w1过滤大量格式化commit找真实业务改动。blame加~绕过.git‑blame‑ignore‑revs看被隐藏的历史提交。补充注意.keys只返回用户上传的SSH公钥不是GPG密钥GPG密钥需要访问用户设置页面API获取。.patch/.diff仅公开仓库有效私有仓库需要登录授权。github.dev 需要登录github账号github1s第三方不需要登录。