当前位置: 代码网 > it编程>编程语言>其他编程 > GitHub隐藏URL的技巧分享

GitHub隐藏URL的技巧分享

2026年08月25日 其他编程 我要评论
一、url后缀技巧(直接改末尾)1..patch/.diff(最常用)对commit、pr、compare页面,直接追加后缀,返回原始文本diff,可直接git apply打补丁。# 单次提交http

一、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.patch

2..raw获取文件原始源码

文件页面末尾改为 /raw,等价页面上的raw按钮,输出无渲染纯文本源码。

原:https://github.com/a/b/blob/main/test.py
改:https://github.com/a/b/raw/main/test.py

3..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.pibb

5..keys用户公钥页面

用户主页后加 .keys,直接拿到该用户所有上传的ssh公钥,安全审计常用。

https://github.com/username.keys

二、url query参数技巧(?xxx=1)

  1. ?w=1:忽略空白字符变更
    pr/files、commit diff页面,过滤仅空格换行改动,代码评审神器。
https://github.com/xxx/yyy/pull/42/files?w=1
  1. ?ts=n 修改tab显示宽度
    设置tab渲染为n个空格,默认ts=8,常用?ts=4
https://github.com/xxx/yyy/blob/main/file.go?ts=4
  1. 行号锚点 #l10 #l10‑l20
    点击行号自动生成,精准定位单行/多行代码片段。
https://github.com/xxx/yyy/blob/main/main.py#l12
https://github.com/xxx/yyy/blob/main/main.py#l12‑l24
  1. 永久固定版本链接(y快捷键)
    普通blob链接会随分支变动;按y,url切换为/blob/<commit‑sha>/xxx,永久不变的固定快照链接(permalink)。

三、域名替换黑魔法

  1. github.dev 网页版vs code
    仓库页面把 github.comgithub.dev,浏览器直接打开完整vs code网页编辑器,等价快捷键.(英文句号)。
https://github.dev/user/repo

快捷键:仓库页面英文输入法直接按 . 一键跳转github.dev。

  1. github1s(第三方,非官方)
https://github1s.com/user/repo

四、compare高级对比url语法

  1. 分支/提交对比
# 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网页vscode
l快速跳转到行号
s聚焦搜索框
g i跳转到issues页面
g p跳转到pull requests页面
b切换分支选择框
shift + ←/→diff页面切换文件

六、提交与issue小技巧

  1. commit message写 fixes #123,合并pr后自动关闭issue。
  2. 评论中粘贴带#lxx代码片段链接,会自动渲染预览代码片段。

七、安全审计场景实用组合

  1. 拿用户ssh公钥:https://github.com/{username}.keys
  2. 批量获取提交补丁:遍历commit url拼接.patch,脚本批量下载分析历史泄露密钥。
  3. ?w=1过滤大量格式化commit,找真实业务改动。
  4. blame加~绕过.git‑blame‑ignore‑revs看被隐藏的历史提交。

补充注意

  • .keys只返回用户上传的ssh公钥,不是gpg密钥;gpg密钥需要访问用户设置页面api获取。
  • .patch/.diff 仅公开仓库有效;私有仓库需要登录授权。
  • github.dev 需要登录github账号;github1s第三方不需要登录。

以上就是github隐藏url的技巧分享的详细内容,更多关于github隐藏url方法的资料请关注代码网其它相关文章!

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2026  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com