博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
github技巧
阅读量:7266 次
发布时间:2019-06-29

本文共 2223 字,大约阅读时间需要 7 分钟。

hot3.png

附上github的一篇github技巧文章:

diff时忽略空格

有些修改只是增减了空格,在URL中添加?w=1就可以忽略。

查看某个作者的提交历史

在URL中添加?author=username,例如:

https://github.com/rails/rails/commits/master?author=dhh

比较版本

使用类似如下的URL比较分支:

https://github.com/rails/rails/compare/master...4-1-stable

同样可以使用一下格式:

https://github.com/rails/rails/compare/master@{1.day.ago}...masterhttps://github.com/rails/rails/compare/master@{2014-10-04}...master

如果想和派生仓库比较,加上派生仓库名作前缀即可:

https://github.com/rails/rails/compare/byroot:master...master

通过 HTML 方式嵌入 Gist

是 GitHub 推出的基于 Git 的代码片段服务。Gists页面提供JavaScript代码,可以将 Gist 嵌入到其他站点。但是很多站点粘贴 JavaScript 无效,这时候你可以在 Gist URL 后附加.pibb,得到一个纯 HTML 的版本,然后就可以复制粘贴 HTML 源码到其他网站了。例如 

Git.io

 是适用于 GitHub 的短网址服务。

当然,为了逼格方便,也可以使用Curl访问:

$ curl -i http://git.io -F "url=https://github.com/..."HTTP/1.1 201 CreatedLocation: http://git.io/abc123$ curl -i http://git.io/abc123HTTP/1.1 302 FoundLocation: https://github.com/...

你甚至可以指定短网址的字段:

$ curl -i http://git.io -F "url=https://github.com/technoweenie" \    -F "code=t"HTTP/1.1 201 CreatedLocation: http://git.io/t

高亮行

例如,在 URL 中加上 #L52 可以高亮第52行。或者你也可以直接点击行数。

多行高亮同样支持。你可以使用类似#L53-L60格式,或者在按住shift的同时点击。

https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60

快速引用

你可以选中别人的评论文字,然后按r,这些内容会以引用的形式被复制在文本框中:

任务列表

在工单或合并请求中,你可以使用任务列表语法:

- [ ] Be awesome- [ ] Do stuff- [ ] Sleep

勾选之后,会更新 Markdown:

- [x] Be awesome- [x] Do stuff- [ ] Sleep

合并请求的 diff 和 patch

可以在 URL 后添加 .diff 和 .patch,以对应的模式查看合并请求:

https://github.com/tiimgreen/github-cheat-sheet/pull/15https://github.com/tiimgreen/github-cheat-sheet/pull/15.diffhttps://github.com/tiimgreen/github-cheat-sheet/pull/15.patch

结果是纯文本的:

diff --git a/README.md b/README.mdindex 88fcf69..8614873 100644--- a/README.md)+++ b/README.md@@ -28,6 +28,7 @@ All the hidden and not hidden features of Git and GitHub. This cheat sheet was i - [Merged Branches](#merged-branches) - [Quick Licensing](#quick-licensing) - [TODO Lists](#todo-lists)+- [Relative Links](#relative-links) - [.gitconfig Recommendations](#gitconfig-recommendations)     - [Aliases](#aliases)     - [Auto-correct](#auto-correct)@@ -381,6 +382,19 @@ When they are clicked, they will be updated in the pure Markdown: - [ ] Sleep(...)

转载于:https://my.oschina.net/lgmcolin/blog/296589

你可能感兴趣的文章
Python核心编程学习笔记(一)
查看>>
jQuery操作iframe中js函数的方法小结
查看>>
[BLE--Link Layer]设备蓝牙地址
查看>>
Redis 错误1067:进程意外终止,Redis不能启动,Redis启动不了
查看>>
Java数据库连接——JDBC调用存储过程,事务管理和高级应用
查看>>
构建自己的 PHP 框架
查看>>
IOS 一句代码搞定启动引导页
查看>>
Ubuntu使用之Svn命令小技巧
查看>>
【项目积累】对JSON数据的处理
查看>>
Vue2+VueRouter2+webpack 构建项目实战(一):准备工作
查看>>
Android网络应用之Socket(一)
查看>>
Vue组件基础用法
查看>>
SWIG 快速入门
查看>>
IN、EXISTS的相关子查询用INNER JOIN 代替--性能优化
查看>>
Java基础(三):修饰符、运算符、循环结构和分支结构
查看>>
聊聊手游的那些惊喜与惊吓
查看>>
hdu4901The Romantic Hero
查看>>
C#读写txt文件的两种方法介绍
查看>>
P2421 A-B数对(增强版)
查看>>
<html>
查看>>