天天看點

少有人知的 GitHub 使用技巧

少有人知的 GitHub 使用技巧

<a target="_blank"></a>

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

少有人知的 GitHub 使用技巧

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

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

少有人知的 GitHub 使用技巧

使用類似如下的url比較分支:

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

少有人知的 GitHub 使用技巧

同樣可以使用一下格式:

https://github.com/rails/rails/compare/master@{1.day.ago}...master

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

如果想和派生倉庫比較,加上派生倉庫名作字首即可:

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

少有人知的 GitHub 使用技巧

當然,為了友善,也可以使用curl通路:

$ curl -i http://git.io -f "url=https://github.com/..."

http/1.1 201 created

location: http://git.io/abc123

$ curl -i http://git.io/abc123

http/1.1 302 found

location: https://github.com/...

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

$ curl -i http://git.io -f "url=https://github.com/technoweenie" \

-f "code=t"

location: http://git.io/t

例如,在 url 中加上 #l52 可以高亮第52行。或者你也可以直接點選行數。

多行高亮同樣支援。你可以使用類似#l53-l60格式,或者在按住shift的同時點選。

https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#l53-l60

少有人知的 GitHub 使用技巧

你可以選中别人的評論文字,然後按r,這些内容會以引用的形式被複制在文本框中:

少有人知的 GitHub 使用技巧

在工單或合并請求中,你可以使用任務清單文法:

- [ ] be awesome

- [ ] do stuff

- [ ] sleep

少有人知的 GitHub 使用技巧

勾選之後,會更新 markdown:

- [x] be awesome

- [x] do stuff

可以在 url 後添加 .diff 和 .patch,以對應的模式檢視合并請求:

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

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

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

結果是純文字的:

diff --git a/readme.md b/readme.md

index 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:

(...)

原文釋出時間為:2014-04-21

本文來自雲栖社群合作夥伴“linux中國”