Github Cheat Sheet

這是我今天幫忙 https://github.com/tiimgreen/github-cheat-sheet 做一個簡單繁體中文版本的 PR,其實只是把簡體中文版本稍微轉換一下而已~

不過其實這篇蠻有意思的,很多值得參考~

GitHub秘笈

Git 和 Github 秘笈,靈感來自於 Zach Holman 在 2012 年 Aloha Ruby Conference 和 2013 年 WDCNZ 上所做的演講:Git and GitHub Secrets(slides) 和 More Git and GitHub Secrets(slides)。

目錄

GitHub

不比較空白字串

在任意 diff 頁面的 UR L後加上 ?w=1,可以去掉那些隻是空白字串的改動,使你能更專註於代碼改動。

Diff without whitespace

詳見 GitHub secrets.

調整 Tab 字串所代表的空格數

在 diff 或文件的 URL 後面加上 ?ts=4 ,這樣當顯示 tab 字串的長度時就會是 4 個空格的長度,不再是默認的 8 個空格。 ts 後面的數字還可以根據你個人的偏好進行修改。這個技巧不適用於 Gists,或者以 Raw 格式查看文件, 但有瀏覽器擴展插件可以幫你自動調整: Chrome 擴展Opera 擴展

下面以一個 Go 語言原始碼為例,看看在 URL 裡添加 ?ts=4 參數的效果。添加前:

Before, tab space example

... 添加後的樣子:

After, tab space example

查看使用者的全部 Commit 歷史

在 Commits 頁面 URL 後加上 ?author={user} 查看使用者全部的提交。

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

DHH commit history

深入了解提交視圖之間的區別

倉庫複製

當複製倉庫時可以不要那個.git後綴。

1
$ git clone https://github.com/tiimgreen/github-cheat-sheet

更多對 Git clone 命令的介紹.

###分支 ####將某個分支與其他所有分支進行比對

當你查看某個倉庫的分支(Branches)頁面(緊挨著 Commits 連接)時

1
https://github.com/{user}/{repo}/branches

你會看到一個包含所有未合併的分支的列表。

在這裡你可以訪問分支比較頁面或刪除某個分支。

Compare branches not merged into master in rails/rails repo - https://github.com/rails/rails/branches

比較分支

如果要在 GitHub 上直接比較兩個分支,可以使用如下形式的 URL :

1
https://github.com/{user}/{repo}/compare/{range}

其中 {range} = master...4-1-stable

例如:

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

Rails branch compare example

{range} 參數還可以使用下面的形式:

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

日期格式 YYYY-DD-MM

Another compare example

diffpatch 頁面裡也可以比較分支:

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

了解更多關於基於時間的 Commit 比較.

比較不同派生庫的分支

想要對派生倉庫(Forked Repository)之間的分支進行比較,可以使用如下的 URL:

1
https://github.com/user/repo/compare/{foreign-user}:{branch}...{own-branch}

例如:

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

Forked branch compare

Gists

Gists 方便我們管理代碼片段,不必使用功能齊全的倉庫。

Gist

Gist 的 URL 後加上 .pibb像這樣)可以得到便於嵌入到其他網站 的 HTML 代碼。

Gists 可以像任何標準倉庫一樣被複製。

1
$ git clone https://gist.github.com/tiimgreen/10545817

Gists

這意味著你可以像 Github 倉庫一樣修改和更新 Gists :

1
$ git commit
2
$ git push
3
Username for 'https://gist.github.com':
4
Password for 'https://tiimgreen@gist.github.com':

但是, Gists 不支持目錄。所有文件都必須添加在倉庫的根目錄下。 進一步了解如何建立 Gists.

Git.io

Git.io是 Github 的短網址服務。

Git.io

你可以通過 Curl 命令以普通 HTTP 協議使用它:

1
$ curl -i http://git.io -F "url=https://github.com/..."
2
HTTP/1.1 201 Created
3
Location: http://git.io/abc123
4
5
$ curl -i http://git.io/abc123
6
HTTP/1.1 302 Found
7
Location: https://github.com/...

進一步了解 Git.io.

鍵盤快捷鍵

在倉庫頁面上提供了快捷鍵方便快速導航。

  • t 鍵打開一個文件瀏覽器。
  • w 鍵打開分支選擇菜單。
  • s 鍵聚焦游標到當前倉庫的搜索框。此時按刪除鍵就會從搜索當前倉庫切換到搜索整個 Github 網站。
  • l 鍵編輯 Issue 列表頁的標籤。
  • 查看文件內容時(如:https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md),按 y 鍵將會凍結這個頁面,這樣就算代碼被修改了也不會影響你當前看到的。

?查看當前頁面支持的快捷鍵列表:

Keyboard shortcuts

進一步了解可用的搜索語法.

整行高亮

在代碼文件地址 URL 後加上#L52或者單擊行號 52 都會將第 52 行代碼高亮顯示。

多行高亮也可以,比如用#L53-L60選擇範圍,或者按住 shift 鍵,然後再點擊選擇的兩行。

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

整行高亮

用 Commit 訊息關閉 Issue

如果某個提交修復了一個 Issue,當提交到 master 分支時,提交訊息裡可以使用 fix/fixes/fixed, close/closes/closed 或者 resolve/resolves/resolved 等關鍵詞,後面再跟上 Issue 號,這樣就會關閉這個 Issue 。

1
$ git commit -m "Fix screwup, fixes #12"

這將會關閉 Issue #12,並且在 Issue 討論列表裡關聯引用這次提交。

Closing Repo

進一步了解通過提交訊息關閉 Issue.

連接其他倉庫的 Issue

如果你想引用到同一個倉庫中的一個 Issue,隻需使用井號 # 加上 Issue 號,這樣就會自動建立到此 Issue 的連接。

要連接到其他倉庫的 Issue ,就使用{user}/{repo}#ISSUE_NUMBER的方式,例如tiimgreen/toc#12

Cross-Link Issues

鎖定項目對話功能

現在倉庫的管理員和合作者可以將 Pull Requests 和 Issue 的評論功能關閉。

Lock conversation

這樣,不是項目合作者的使用者就不能在這個項目上使用評論功能。

Comments locked

進一步了解對話鎖定功能.

設置 CI 對每條 Pull Request 都進行構建

如果設置正確,Travis CI 會為每個你收到的 Pull Request 執行構建,就像每次提交也會觸發構建一樣。想了解更多關於 Travis CI 的訊息,請參考 Travis CI入門

Travis CI status

進一步了解提交狀態 API.

Markdown 文件語法高亮

例如,可以像下面這樣在你的 Markdown 文件裡為 Ruby 代碼添加語法高亮:

1
require 'tabbit'
2
table = Tabbit.new('Name', 'Email')
3
table.add_row('Tim Green', 'tiimgreen@gmail.com')
4
puts table.to_s

效果如下:

1
require 'tabbit'
2
table = Tabbit.new('Name', 'Email')
3
table.add_row('Tim Green', 'tiimgreen@gmail.com')
4
puts table.to_s

Github使用 Linguist 做語言識別和語法高亮。你可以仔細閱讀 languages YAML file,了解有哪些可用的關鍵字。

進一步了解 GitHub Flavored Markdown.

表情符號

可以在 Pull Requests, Issues, 提交消息, Markdown 文件裡加入表情符號。使用方法 :name_of_emoji:

1
:smile:

將輸出一個笑臉:

:smile:

Github 支持的完整表情符號號列表詳見emoji-cheat-sheet.comscotch-io/All-Github-Emoji-Icons

Github 上使用最多的5個表情符號號是:

  1. :shipit:
  2. :sparkles:
  3. :-1:
  4. :+1:
  5. :clap:

圖片 / GIF 動畫

註解和README等文件裡也可以使用圖片和 GIF 動畫:

1
![Alt Text](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)

倉庫中的圖片可以被直接引用:

1
![Alt Text](https://github.com/{user}/{repo}/raw/master/path/to/image.gif)

Peter don't care

所有圖片都緩存在 Github,不用擔心你的網站不能訪問時就看不到圖片了。

在 GitHub Wiki 中引用圖片

有多種方法可以在 Wiki 頁面裡嵌入圖片。既可以像上一條裡那樣使用標準的 Markdown 語法,也可以像下面這樣指定圖片的高度或寬度:

1
[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]

結果:

Just a screenshot

快速引用

在主題評論中引用之前某個人所說的,只需選中文件,然後按 r 鍵,想要的就會以引用的形式複製到你的輸入框裡。

Quick Quote

進一步了解快速引用.

複製貼上剪貼板中的圖片到評論

(僅適用於 Chrome 瀏覽器)

當截屏圖片複製到剪貼板後(mac 上用 cmd-ctrl-shift-4),你可以用(cmd-v / ctrl-v)把圖片複製貼上到評論框裡,然後它就會自動上傳到 Github。

Pasting Clipboard Image to Comments

進一步了解在 issue 中使用附件

快速添加許可證文件

建立一個倉庫時,Github會為你提供一個預設的軟體授權條款:

License

對於已有的倉庫,可以通過 web 界面建立文件來添加軟體授權條款。輸入LICENSE作為文件名後,同樣可以從預設的列表中選擇一個作為模板。

License

這個技巧也適用於 .gitignore 文件。

進一步了解開源許可證

任務列表

Issues 和 Pull requests 裡可以添加複選框,語法如下(註意空白符):

1
- [ ] Be awesome
2
- [ ] Prepare dinner
3
  - [ ] Research recipe
4
  - [ ] Buy ingredients
5
  - [ ] Cook recipe
6
- [ ] Sleep

Task List

當項目被選中時,它對應的 Markdown 原始碼也被更新了:

1
- [x] Be awesome
2
- [ ] Prepare dinner
3
  - [x] Research recipe
4
  - [x] Buy ingredients
5
  - [ ] Cook recipe
6
- [ ] Sleep

進一步了解任務列表.

Markdown 文件中的任務列表

在完全符合Markdown語法的文件中可以使用以下語法加入一個只讀的任務列表

1
- [ ] Mercury
2
- [x] Venus
3
- [x] Earth
4
  - [x] Moon
5
- [x] Mars
6
  - [ ] Deimos
7
  - [ ] Phobos
  • Mercury
  • Venus
  • Earth
    • Moon
  • Mars
    • Deimos
    • Phobos

進一步了解 Markdown 文件中的任務列表

相對連接

Markdown文件裡連接到內部內容時推薦使用相對連接。

1
[Link to a header](#awesome-section)
2
[Link to a file](docs/readme)

絕對連接會在 URL 改變時(例如重新命名倉庫、使用者名稱改變,建立分支項目)被更新。使用相對連接能夠保證你的文件不受此影響。

進一步了解相對連接.

GitHub Pages 的中繼資料與插件支持

在 Jekyll 頁面和文章裡,倉庫訊息可在 site.github 命名空間下找到,也可以顯示出來,例如,使用 顯示項目標題。

Jemoji 和 jekyll-mentions 插件為你的 Jekyll 文章和頁面增加了emoji@mentions功能。

了解更多 GitHub Pages 的中繼資料和插件支持.

查看 YAML 格式的中繼資料

許多博客網站,比如基於 JekyllGitHub Pages ,都依賴於一些文章頭部的 YAML 格式的中繼資料。 Github 會將其渲染成一個水平表格,方便閱讀。

YAML metadata

進一步了解 在文件裡查看 YAML 中繼資料.

渲染表格數據

GitHub 支持將 .csv (逗號分隔)和 .tsv (定位點分隔)格式的文件渲染成表格數據。

Tabular data

進一步了解渲染表格數據.

撤銷 Pull Request

合併一個 Pull Request 之後,你可能會反悔:要麼是這次 Pull Request 沒什麼用處,要麼是還不到合併的時候。

此時可以通過 Pull Request 中的 Revert 按鈕來撤銷一個已合併的 Pull Request 中的 commit。按下按鈕後將自動生成一個進行逆操作的 Pull Request。

Revert button

*進一步了解「撤銷」按鈕

Diffs

可渲染文件的Diffs

Commit 和 Pull Request 裡包含有 Github 支持的可渲染文件(比如 Markdown)會提供sourcerendered 兩個視圖功能。

Source / Rendered view

點擊 "rendered" 按鈕,看看改動在渲染後的顯示效果。當你添加、刪除或修改文件時,渲染純文件視圖非常方便。

Rendered Prose Diffs

進一步了解渲染純文件視圖Diffs.

可比較的地圖數據

當你在GitHub上查看一個包含地理數據的 commit 或 pull request時,Github 將以可視化的方式比對版本之間的差異。

Diffable Maps

進一步了解可比較的地圖數據.

在 Diff 中展開查看更多的上下文

你可以通過點擊 diff 邊欄裡的 unfold 按鈕來多顯示幾行上下文。你可以一直點擊 unfold 按鈕直到顯示了文件的全部內容。這個功能在所有 GitHub 的 diff 功能中都可以使用。

Expanding Context in Diffs

進一步了解展開 Diff 上下文.

獲取 Pull Request 的 diff 或 patch 文件

在 Pull Request 的 URL 後面加上 .diff.patch 的擴展名就可以得到它的 diff 或 patch 文件,例如:

1
https://github.com/tiimgreen/github-cheat-sheet/pull/15
2
https://github.com/tiimgreen/github-cheat-sheet/pull/15.diff
3
https://github.com/tiimgreen/github-cheat-sheet/pull/15.patch

.diff 擴展會使用普通文件格式顯示如下內容:

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

顯示圖片以及比較圖片

GitHub 可以顯示包括 PNG、JPG、GIF、PSD 在內的多種圖片格式並提供了幾種方式來比較這些格式的圖片文件版本間的不同。

Diffable PSD

查看更多關於圖片顯示和比較

Hub

Hub 是一個對 Git 進行了封裝的命令行工具,可以幫助你更方便的使用 Github。

例如可以像下面這樣進行複製:

1
$ hub clone tiimgreen/toc

查看更多 Hub 提供的超酷命令.

貢獻者指南

在倉庫的根目錄添加一個名為 CONTRIBUTING 的文件後,貢獻者在新建 Issue 或 Pull Request 時會看到一個指向這個文件的連接。

Contributing Guidelines

進一步了解貢獻者指南.

Octicons

GitHubs 圖標庫 (Octicons) 現已開源。

Octicons

進一步了解 GitHub 圖標庫

GitHub 資源

內容 連接
探索 GitHub https://github.com/explore
GitHub 博客 https://github.com/blog
GitHub 幫助 https://help.github.com/
GitHub 培訓 http://training.github.com/
GitHub 開發者 https://developer.github.com/

GitHub 相關演講視頻

內容 連接
How GitHub Uses GitHub to Build GitHub https://www.youtube.com/watch?v=qyz3jkOBbQY
Introduction to Git with Scott Chacon of GitHub https://www.youtube.com/watch?v=ZDR433b0HJY
How GitHub No Longer Works https://www.youtube.com/watch?v=gXD1ITW7iZI
Git and GitHub Secrets https://www.youtube.com/watch?v=Foz9yvMkvlA
More Git and GitHub Secrets https://www.youtube.com/watch?v=p50xsL-iVgU

Git

從工作區去除大量已刪除文件

當用 /bin/rm 命令刪除了大量文件之後,你可以用下面一條命令從工作區和索引中去除這些文件,以免一個一個的刪除:

1
$ git rm $(git ls-files -d)

例如:

1
$ git status
2
On branch master
3
Changes not staged for commit:
4
	deleted:    a
5
	deleted:    c
6
7
$ git rm $(git ls-files -d)
8
rm 'a'
9
rm 'c'
10
11
$ git status
12
On branch master
13
Changes to be committed:
14
	deleted:    a
15
	deleted:    c

上一個分支

快速檢出上一個分支:

1
$ git checkout -
2
# Switched to branch 'master'
3
4
$ git checkout -
5
# Switched to branch 'next'
6
7
$ git checkout -
8
# Switched to branch 'master'

進一步了解 Git 分支.

去除空白

Git Stripspace 命令可以:

  • 去掉行尾空白符
  • 多個空行壓縮成一行
  • 必要時在文件末尾增加一個空行

使用此命令時必須傳入一個文件,像這樣:

1
$ git stripspace < README.md

進一步了解 Git stripspace 命令.

檢出 Pull Requests

對 Github 倉庫來說,Pull Request 是種特殊分支, 可以通過以下多種方式取到本地:

取出某個特定的 Pull Request 並臨時作為本地的 FETCH_HEAD 中以便進行快速查看更改( diff )以及合併( merge ):

1
$ git fetch origin refs/pull/[PR-Number]/head

通過 refspec 獲取所有的 Pull Request 為本地分支:

1
$ git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'

或在倉庫的 .git/config 中加入下列設置來自動獲取遠程倉庫中的 Pull Request

1
[remote "origin"]
2
    fetch = +refs/heads/*:refs/remotes/origin/*
3
    url = git@github.com:tiimgreen/github-cheat-sheet.git
1
[remote "origin"]
2
    fetch = +refs/heads/*:refs/remotes/origin/*
3
    url = git@github.com:tiimgreen/github-cheat-sheet.git
4
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

對基於派生庫的 Pull Request,可以通過先 checkout 代表此 Pull Request 的遠端分支再由此分支建立一個本地分支:

1
$ git checkout pr/42 pr-42

操作多個倉庫的時候,可以在 Git 中設置獲取 Pull Request 的全局選項。

1
git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"

此時可以在任意倉庫中使用以下命令:

1
git fetch origin
1
git checkout pr/42

進一步了解如何本地檢出 pull request.

沒有任何改動的提交

可以使用--allow-empty選項強製建立一個沒有任何改動的提交:

1
$ git commit -m "Big-ass commit" --allow-empty

這樣做在如下幾種情況下是有意義的:

  • 標記新的工作或一個新功能的開始。

  • 記錄對項目的跟代碼無關的改動。

  • 跟使用你倉庫的其他人交流。

  • 作為倉庫的第一次提交,因為第一次提交後不能被 rebase: git commit -m "init repo" --allow-empty.

    It ain't even that trolololol...

美化 Git Status

在命令行輸入如下命令:

1
$ git status

可以看到:

git status

加上-sb選項:

1
$ git status -sb

這會得到:

git status -sb

進一步了解 Git status 命令.

美化 Git Log

輸入如下命令:

1
$ git log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

可以看到:

git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

這要歸功於 Palesz 在 stackoverflow 的回答。

這個命令可以被用作別名,詳細做法見這裡

進一步了解 Git log 命令.

Git 查詢

Git 查詢運行你在之前的所有提交訊息裡進行搜索,找到其中和搜索條件相匹配的最近的一條。

1
$ git show :/query

這裡 query (區別大小寫)是你想要搜索的詞語, 這條命令會找到包含這個詞語的最後那個提交並顯示變動詳情。

1
$ git show :/typo

git show :/query

  • q 鍵退出命令。*

合併分支

輸入命令:

1
$ git branch --merged

這會顯示所有已經合併到你當前分支的分支列表。

相反地:

1
$ git branch --no-merged

會顯示所有還沒有合併到你當前分支的分支列表。

進一步了解 Git branch 命令.

修復有問題的提交以及自動合併

如果上一個或多個提交包含了錯誤,可以在你修復問題後使用下列命令處理(假設要修復的提交版本是abcde):

1
$ git commit --fixup=abcde
2
$ git rebase abcde^ --autosquash -i

進一步了解 Git commit 命令. 進一步了解 Git rebase 命令.

以網站方式查看本地倉庫

使用 Git 的 instaweb 可以立即在 gitweb 中瀏覽你的工作倉庫。這個命令是個簡單的腳本,設置了 gitweb 和用來瀏覽本地倉庫的Web服務器。(譯者註:默認需要lighttpd支持)

1
$ git instaweb

執行後打開:

Git instaweb

進一步了解 Git instaweb 命令.

Git 設置

所有 Git 設置都保存在你的 .gitconfig 文件中。

Git 命令自定義別名

別名用來幫助你定義自己的 git 命令。比如你可以定義 git a 來運行 git add --all

要添加一個別名, 一種方法是打開 ~/.gitconfig 文件並添加如下內容:

1
[alias]
2
  co = checkout
3
  cm = commit
4
  p = push
5
  # Show verbose output about tags, branches or remotes
6
  tags = tag -l
7
  branches = branch -a
8
  remotes = remote -v

...或者在命令行裡鍵入:

1
$ git config --global alias.new_alias git_function

例如:

1
$ git config --global alias.cm commit

指向多個命令的別名可以用引號來定義:

1
$ git config --global alias.ac 'add -A . && commit'

下面列出了一些有用的別名:

別名 Alias 命令 Command 如何設置 What to Type
git cm git commit git config --global alias.cm commit
git co git checkout git config --global alias.co checkout
git ac git add . -A git commit git config --global alias.ac '!git add -A && git commit'
git st git status -sb git config --global alias.st 'status -sb'
git tags git tag -l git config --global alias.tags 'tag -l'
git branches git branch -a git config --global alias.branches 'branch -a'
git cleanup `git branch --merged grep -v '*'
git remotes git remote -v git config --global alias.remotes 'remote -v'
git lg git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"

自動更正

如果鍵入 git comit 你會看到如下輸出:

1
$ git comit -m "Message"
2
# git: 'comit' is not a git command. See 'git --help'.
3
4
# Did you mean this?
5
#   commit

為了在鍵入 comit 調用 commit命令,隻需啟用自動糾錯功能:

1
$ git config --global help.autocorrect 1

現在你就會看到:

1
$ git comit -m "Message"
2
# WARNING: You called a Git command named 'comit', which does not exist.
3
# Continuing under the assumption that you meant 'commit'
4
# in 0.1 seconds automatically...

顏色輸出

要在你的 Git 命令輸出裡加上顏色的話,可以用如下命令:

1
$ git config --global color.ui 1

進一步了解 Git config 命令.

Git 資源

Title Link
Official Git Site http://git-scm.com/
Official Git Video Tutorials http://git-scm.com/videos
Code School Try Git http://try.github.com/
Introductory Reference & Tutorial for Git http://gitref.org/
Official Git Tutorial http://git-scm.com/docs/gittutorial
Everyday Git http://git-scm.com/docs/everyday
Git Immersion http://gitimmersion.com/
Ry's Git Tutorial http://rypress.com/tutorials/git/index.html
Git for Designer http://hoth.entp.com/output/git_for_designers.html
Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/
Git Magic http://www-cs-students.stanford.edu/~blynn/gitmagic/
GitHub Training Kit http://training.github.com/kit
Git Visualization Playground http://onlywei.github.io/explain-git-with-d3/#freeplay

Git 參考書籍

Title Link
Pragmatic Version Control Using Git http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git
Pro Git http://git-scm.com/book
Git Internals Peepcode http://peepcode.com/products/git-internals-pdf
Git in the Trenches http://cbx33.github.com/gitt/
Version Control with Git http://www.amazon.com/Version-Control-Git-collaborative-development/dp/1449316387
Pragmatic Guide to Git http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git
Git: Version Control for Everyone http://www.packtpub.com/git-version-control-for-everyone/book