mirror of
https://github.com/tiimgreen/github-cheat-sheet.git
synced 2025-08-08 08:56:35 +02:00
Merge pull request #45 from tonyxue/master
Change the table of contents into Chinese of the Chinese version
This commit is contained in:
182
README.zh-cn.md
182
README.zh-cn.md
@@ -5,59 +5,59 @@
|
||||
|
||||
# 目录
|
||||
- [GitHub](#github)
|
||||
- [Ignore Whitespace](#ignore-whitespace)
|
||||
- [Adjust Tab Space](#adjust-tab-space)
|
||||
- [Commit History by Author](#commit-history-by-author)
|
||||
- [Cloning a Repository](#cloning-a-repository)
|
||||
- [Comparing Branches](#comparing-branches)
|
||||
- [Compare Branches across Forked Repositories](#compare-branches-across-forked-repositories)
|
||||
- [忽略空白字符变化](#%E8%B0%83%E6%95%B4tab%E5%AD%97%E7%AC%A6%E6%89%80%E4%BB%A3%E8%A1%A8%E7%9A%84%E7%A9%BA%E6%A0%BC%E6%95%B0)
|
||||
- [调整Tab字符所代表的空格数](#%E8%B0%83%E6%95%B4tab%E5%AD%97%E7%AC%A6%E6%89%80%E4%BB%A3%E8%A1%A8%E7%9A%84%E7%A9%BA%E6%A0%BC%E6%95%B0)
|
||||
- [查看某个用户的Commit历史](#%E6%9F%A5%E7%9C%8B%E6%9F%90%E4%B8%AA%E7%94%A8%E6%88%B7%E7%9A%84commit%E5%8E%86%E5%8F%B2)
|
||||
- [克隆某个仓库](#%E5%85%8B%E9%9A%86%E6%9F%90%E4%B8%AA%E4%BB%93%E5%BA%93)
|
||||
- [比较分支](#%E6%AF%94%E8%BE%83%E5%88%86%E6%94%AF)
|
||||
- [比较不同派生库的分支](#%E6%AF%94%E8%BE%83%E4%B8%8D%E5%90%8C%E6%B4%BE%E7%94%9F%E5%BA%93%E7%9A%84%E5%88%86%E6%94%AF)
|
||||
- [Gists](#gists)
|
||||
- [Git.io](#gitio)
|
||||
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
||||
- [Line Highlighting in Repositories](#line-highlighting-in-repositories)
|
||||
- [Closing Issues via Commit Messages](#closing-issues-via-commit-messages)
|
||||
- [Cross-Link Issues](#cross-link-issues)
|
||||
- [CI Status on Pull Requests](#ci-status-on-pull-requests)
|
||||
- [Syntax Highlighting in Markdown Files](#syntax-highlighting-in-markdown-files)
|
||||
- [Emojis](#emojis)
|
||||
- [Images/GIFs](#imagesgifs)
|
||||
- [Embedding Images in GitHub Wiki](#embedding-images-in-github-wiki)
|
||||
- [Quick Quoting](#quick-quoting)
|
||||
- [Quick Licensing](#quick-licensing)
|
||||
- [Task Lists](#task-lists)
|
||||
- [Relative Links](#relative-links)
|
||||
- [Metadata and Plugin Support for GitHub Pages](#metadata-and-plugin-support-for-github-pages)
|
||||
- [Viewing YAML Metadata in your Documents](#viewing-yaml-metadata-in-your-documents)
|
||||
- [Rendering Tabular Data](#rendering-tabular-data)
|
||||
- [键盘快捷键](#%E9%94%AE%E7%9B%98%E5%BF%AB%E6%8D%B7%E9%94%AE)
|
||||
- [整行高亮](#%E6%95%B4%E8%A1%8C%E9%AB%98%E4%BA%AE)
|
||||
- [用commit信息关闭Issue](#%E7%94%A8commit%E4%BF%A1%E6%81%AF%E5%85%B3%E9%97%ADissue)
|
||||
- [链接其他仓库的Issue](#%E9%93%BE%E6%8E%A5%E5%85%B6%E4%BB%96%E4%BB%93%E5%BA%93%E7%9A%84issue)
|
||||
- [设置CI对每条Pull Request都进行构建](#%E8%AE%BE%E7%BD%AEci%E5%AF%B9%E6%AF%8F%E6%9D%A1pull-request%E9%83%BD%E8%BF%9B%E8%A1%8C%E6%9E%84%E5%BB%BA)
|
||||
- [Markdown文件高亮语法](#markdown%E6%96%87%E4%BB%B6%E9%AB%98%E4%BA%AE%E8%AF%AD%E6%B3%95)
|
||||
- [表情符](#%E8%A1%A8%E6%83%85%E7%AC%A6)
|
||||
- [静态与动态图片](#%E9%9D%99%E6%80%81%E4%B8%8E%E5%8A%A8%E6%80%81%E5%9B%BE%E7%89%87)
|
||||
- [在GitHub Wiki中嵌入图片](#%E5%9C%A8github-wiki%E4%B8%AD%E5%B5%8C%E5%85%A5%E5%9B%BE%E7%89%87)
|
||||
- [快速引用](#%E5%BF%AB%E9%80%9F%E5%BC%95%E7%94%A8)
|
||||
- [快速添加许可证](#%E5%BF%AB%E9%80%9F%E6%B7%BB%E5%8A%A0%E8%AE%B8%E5%8F%AF%E8%AF%81)
|
||||
- [任务列表](#%E4%BB%BB%E5%8A%A1%E5%88%97%E8%A1%A8)
|
||||
- [相对链接](#%E7%9B%B8%E5%AF%B9%E9%93%BE%E6%8E%A5)
|
||||
- [GitHub Pages的元数据与插件支持](#github-pages%E7%9A%84%E5%85%83%E6%95%B0%E6%8D%AE%E4%B8%8E%E6%8F%92%E4%BB%B6%E6%94%AF%E6%8C%81)
|
||||
- [查看YAML格式的元数据](#%E6%9F%A5%E7%9C%8Byaml%E6%A0%BC%E5%BC%8F%E7%9A%84%E5%85%83%E6%95%B0%E6%8D%AE)
|
||||
- [渲染表格数据](#%E6%B8%B2%E6%9F%93%E8%A1%A8%E6%A0%BC%E6%95%B0%E6%8D%AE)
|
||||
- [Diffs](#diffs)
|
||||
- [Rendered prose Diffs](#rendered-prose-diffs)
|
||||
- [Diffable Maps](#diffable-maps)
|
||||
- [Expanding Context in Diffs](#expanding-context-in-diffs)
|
||||
- [Diff or Patch of Pull Request](#diff-or-patch-of-pull-request)
|
||||
- [可渲染文档的Diffs](#%E5%8F%AF%E6%B8%B2%E6%9F%93%E6%96%87%E6%A1%A3%E7%9A%84diffs)
|
||||
- [可变化地图](#%E5%8F%AF%E5%8F%98%E5%8C%96%E5%9C%B0%E5%9B%BE)
|
||||
- [在diff中折叠与扩展代码](#%E5%9C%A8diff%E4%B8%AD%E6%8A%98%E5%8F%A0%E4%B8%8E%E6%89%A9%E5%B1%95%E4%BB%A3%E7%A0%81)
|
||||
- [查看Pull Request的diff和patch](#%E6%9F%A5%E7%9C%8Bpull-request%E7%9A%84diff%E5%92%8Cpatch)
|
||||
- [Hub](#hub)
|
||||
- [Decreasing Contributor Friction](#decreasing-contributor-friction)
|
||||
- [Contributing Guidelines](#contributing-guidelines)
|
||||
- [GitHub Resources](#github-resources)
|
||||
- [GitHub Talks](#github-talks)
|
||||
- [贡献内容的自动检查](#%E8%B4%A1%E7%8C%AE%E5%86%85%E5%AE%B9%E7%9A%84%E8%87%AA%E5%8A%A8%E6%A3%80%E6%9F%A5)
|
||||
- [贡献者指南](#%E8%B4%A1%E7%8C%AE%E8%80%85%E6%8C%87%E5%8D%97)
|
||||
- [GitHub资源](#github%E8%B5%84%E6%BA%90)
|
||||
- [GitHub讨论](#github%E8%AE%A8%E8%AE%BA)
|
||||
- [Git](#git)
|
||||
- [Previous Branch](#previous-branch)
|
||||
- [Stripspace](#stripspace)
|
||||
- [Checking out Pull Requests](#checking-out-pull-requests)
|
||||
- [Empty Commits :trollface:](#empty-commits-trollface)
|
||||
- [Styled Git Status](#styled-git-status)
|
||||
- [Styled Git Log](#styled-git-log)
|
||||
- [Git Query](#git-query)
|
||||
- [Merged Branches](#merged-branches)
|
||||
- [Web Server for Browsing Local Repositories](#web-server-for-browsing-local-repositories)
|
||||
- [Git Configurations](#git-configurations)
|
||||
- [Aliases](#aliases)
|
||||
- [Auto-Correct](#auto-correct)
|
||||
- [Color](#color)
|
||||
- [Git Resources](#git-resources)
|
||||
- [Git Books](#git-books)
|
||||
- [前一个分支](#%E5%89%8D%E4%B8%80%E4%B8%AA%E5%88%86%E6%94%AF)
|
||||
- [Stripspace命令](#stripspace%E5%91%BD%E4%BB%A4)
|
||||
- [检出Pull Requests](#%E6%A3%80%E5%87%BApull-requests)
|
||||
- [提交空改动 :trollface:](#%E6%8F%90%E4%BA%A4%E7%A9%BA%E6%94%B9%E5%8A%A8-trollface)
|
||||
- [更直观的Git Status](#%E6%9B%B4%E7%9B%B4%E8%A7%82%E7%9A%84git-status)
|
||||
- [更直观的Git Log](#%E6%9B%B4%E7%9B%B4%E8%A7%82%E7%9A%84git-log)
|
||||
- [Git查询](#git%E6%9F%A5%E8%AF%A2)
|
||||
- [合并分支](#%E5%90%88%E5%B9%B6%E5%88%86%E6%94%AF)
|
||||
- [使用网页查看本地仓库](#%E4%BD%BF%E7%94%A8%E7%BD%91%E9%A1%B5%E6%9F%A5%E7%9C%8B%E6%9C%AC%E5%9C%B0%E4%BB%93%E5%BA%93)
|
||||
- [Git配置](#git%E9%85%8D%E7%BD%AE)
|
||||
- [Git命令自定义别名](#git%E5%91%BD%E4%BB%A4%E8%87%AA%E5%AE%9A%E4%B9%89%E5%88%AB%E5%90%8D)
|
||||
- [自动更正](#%E8%87%AA%E5%8A%A8%E6%9B%B4%E6%AD%A3)
|
||||
- [带颜色输出](#%E5%B8%A6%E9%A2%9C%E8%89%B2%E8%BE%93%E5%87%BA)
|
||||
- [Git资源](#git%E8%B5%84%E6%BA%90)
|
||||
- [Git参考书籍](#git%E5%8F%82%E8%80%83%E4%B9%A6%E7%B1%8D)
|
||||
|
||||
## GitHub
|
||||
### Ignore Whitespace
|
||||
### 忽略空白字符变化
|
||||
|
||||
在任意diff页面的URL后加上`?w=1`,可以去掉那些只是空白字符的变化,使你能更专注于代码的变化。
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
[*详见 GitHub secrets.*](https://github.com/blog/967-github-secrets)
|
||||
|
||||
### Adjust Tab Space
|
||||
### 调整Tab字符所代表的空格数
|
||||
在diff或者file页面的URL后面加上`?ts=4`,这样当显示tab字符的长度时就会是4个空格的长度,不再是默认的8个空格。`ts`后面的数字还可以根据你个人的偏好进行修改。不过,这个小诀窍在Gists页面和raw file页面不起作用。
|
||||
|
||||
下面是我们在Go语言的source file页面URL后加`?ts=4`[前](https://github.com/pengwynn/flint/blob/master/flint/flint.go)的例子:
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||

|
||||
|
||||
### Commit History by Author
|
||||
### 查看某个用户的Commit历史
|
||||
查看某个用户的所有提交历史,只需在commits页面URL后加上`?author=username`。
|
||||
|
||||
```
|
||||
@@ -87,7 +87,7 @@ https://github.com/rails/rails/commits/master?author=dhh
|
||||
|
||||
[*深入了解提交视图之间的区别*](https://help.github.com/articles/differences-between-commit-views)
|
||||
|
||||
### Cloning Repository
|
||||
### 克隆某个仓库
|
||||
当我们克隆某一资源时,可以不要那个`.git`后缀。
|
||||
|
||||
```bash
|
||||
@@ -96,7 +96,7 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet
|
||||
|
||||
[*更多对 Git `clone` 命令的介绍.*](http://git-scm.com/docs/git-clone)
|
||||
|
||||
### Comparing Branches
|
||||
### 比较分支
|
||||
|
||||
如果我们想要比较两个分支,可以像下面一样修改URL:
|
||||
|
||||
@@ -129,7 +129,7 @@ https://github.com/rails/rails/compare/master@{2014-10-04}...master
|
||||
|
||||
[*了解更多关于比较跨时间段的提交记录.*](https://help.github.com/articles/comparing-commits-across-time)
|
||||
|
||||
### Compare Branches across Forked Repositories
|
||||
### 比较不同派生库的分支
|
||||
|
||||
想要对派生仓库(Forked Repository)之间的分支进行比较,可以像下面这样修改URL实现:
|
||||
|
||||
@@ -182,7 +182,7 @@ Location: https://github.com/...
|
||||
|
||||
[*进一步了解 Git.io.*](https://github.com/blog/985-git-io-github-url-shortener)
|
||||
|
||||
### Keyboard Shortcuts
|
||||
### 键盘快捷键
|
||||
|
||||
在仓库主页上提供了快捷键方便快速导航。
|
||||
|
||||
@@ -198,7 +198,7 @@ Location: https://github.com/...
|
||||
|
||||
[*进一步了解如何使用 Command Bar.*](https://help.github.com/articles/using-the-command-bar)
|
||||
|
||||
### Line Highlighting in Repositories
|
||||
### 整行高亮
|
||||
|
||||
在代码文件地址后加上`#L52`或者单击行号52都会将第52行代码高亮显示。
|
||||
|
||||
@@ -208,9 +208,9 @@ Location: https://github.com/...
|
||||
https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60
|
||||
```
|
||||
|
||||

|
||||

|
||||
|
||||
### Closing Issues via Commit Messages
|
||||
### 用commit信息关闭Issue
|
||||
|
||||
如果某个提交修复了一个Issue,当提交到master分支时,提交信息里可以使用`fix/fixes/fixed`, `close/closes/closed` 或者 `resolve/resolves/resolved`等关键词,后面再跟上Issue号,这样就会关闭这个Issue。
|
||||
|
||||
@@ -224,21 +224,21 @@ $ git commit -m "Fix screwup, fixes #12"
|
||||
|
||||
[*进一步了解通过提交信息关闭Issue.*](https://help.github.com/articles/closing-issues-via-commit-messages)
|
||||
|
||||
### Cross-Link Issues
|
||||
### 链接其他仓库的Issue
|
||||
如果你想引用到同一个仓库中的一个Issue,只需使用井号 `#` 加上Issue号,这样就会自动创建到此Issue的链接。
|
||||
|
||||
要链接到其他仓库的Issue,就使用`user_name/repo_name#ISSUE_NUMBER`的方式,例如`tiimgreen/toc#12`。
|
||||
|
||||

|
||||
|
||||
### CI Status on Pull Requests
|
||||
### 设置CI对每条Pull Request都进行构建
|
||||
如果配置正确,[Travis CI](https://travis-ci.org/)会为每个你收到的Pull Request执行构建,就像每次提交也会触发构建一样。想了解更多关于Travis CI的信息,请看 [Travis CI入门](http://docs.travis-ci.com/user/getting-started/)。
|
||||
|
||||
[](https://github.com/octokit/octokit.rb/pull/452)
|
||||
|
||||
[*进一步了解 Commit status API.*](https://github.com/blog/1227-commit-status-api)
|
||||
|
||||
### Syntax Highlighting in Markdown Files
|
||||
### Markdown文件高亮语法
|
||||
例如,可以像下面这样在你的Markdown文件里为Ruby代码添加语法高亮:
|
||||
|
||||
```ruby
|
||||
@@ -261,7 +261,7 @@ Github使用 [Linguist](https://github.com/github/linguist) 做语言识别和
|
||||
|
||||
[*进一步了解 GitHub Flavored Markdown.*](https://help.github.com/articles/github-flavored-markdown)
|
||||
|
||||
### Emojis
|
||||
### 表情符
|
||||
|
||||
可以在Pull Requests, Issues, 提交消息, Markdown文件里加入表情符。使用方法`:name_of_emoji:`
|
||||
|
||||
@@ -282,7 +282,7 @@ Github上使用最多的5个表情符号是:
|
||||
4. :+1: - `:+1:`
|
||||
5. :clap: - `:clap:`
|
||||
|
||||
### Images/GIFS
|
||||
### 静态与动态图片
|
||||
注释和README等文件里也可以使用图片和GIF动画:
|
||||
|
||||
```
|
||||
@@ -293,7 +293,7 @@ Github上使用最多的5个表情符号是:
|
||||
|
||||
所有图片都缓存在Gitub,不用担心你的站点不能访问时就看不到图片了。
|
||||
|
||||
#### Embedding Images in GitHub Wiki
|
||||
#### 在GitHub Wiki中嵌入图片
|
||||
有多种方法可以在Wiki页面里嵌入图片。既可以像上一条里那样使用标准的Markdown语法,也可以像下面这样指定图片的高度或宽度:
|
||||
|
||||
```markdown
|
||||
@@ -303,14 +303,14 @@ Github上使用最多的5个表情符号是:
|
||||
|
||||

|
||||
|
||||
### Quick Quoting
|
||||
### 快速引用
|
||||
在注释话题里引用之前某个人所说的,只需选中文本,然后按 `r`键,想要的就会以引用的形式复制到你的输入框里。
|
||||
|
||||

|
||||
|
||||
[*进一步了解快速引用.*](https://github.com/blog/1399-quick-quotes)
|
||||
|
||||
### Quick Licensing
|
||||
### 快速添加许可证
|
||||
创建一个仓库时,Github会为你提供一个预置的软件许可列表:
|
||||
|
||||

|
||||
@@ -323,7 +323,7 @@ Github上使用最多的5个表情符号是:
|
||||
|
||||
[*进一步了解 open source licensing.*](https://help.github.com/articles/open-source-licensing)
|
||||
|
||||
### Task Lists
|
||||
### 任务列表
|
||||
Issues和Pull requests里可以添加复选框,语法如下(注意空白符):
|
||||
|
||||
```
|
||||
@@ -344,7 +344,7 @@ Issues和Pull requests里可以添加复选框,语法如下(注意空白符
|
||||
|
||||
[*进一步了解任务列表.*](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments)
|
||||
|
||||
### Relative Links
|
||||
### 相对链接
|
||||
Markdown文件里链接到内部内容时推荐使用相对链接。
|
||||
|
||||
```markdown
|
||||
@@ -355,21 +355,21 @@ Markdown文件里链接到内部内容时推荐使用相对链接。
|
||||
|
||||
[*进一步了解相对链接.*](https://help.github.com/articles/relative-links-in-readmes)
|
||||
|
||||
### Metadata and Plugin Support for GitHub Pages
|
||||
### GitHub Pages的元数据与插件支持
|
||||
在Jekyll页面和文章里,仓库信息可在 `site.github` 命名空间下找到,也可以显示出来,例如,使用 `{{ site.github.project_title }}`显示项目标题。
|
||||
|
||||
Jemoji和jekyll-mentions插件为你的Jekyll文章和页面增加了[emoji](#emojis)和[@mentions](https://github.com/blog/821)功能。
|
||||
|
||||
[*了解更多 GitHub Pages的元数据和插件支持.*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages)
|
||||
|
||||
### Viewing YAML Metadata in your Documents
|
||||
### 查看YAML格式的元数据
|
||||
许多博客站点,比如基于[Jekyll](http://jekyllrb.com/)的[GitHub Pages](http://pages.github.com/),都依赖于一些文章头部的YAML格式的元数据。Github会将其渲染成一个水平表格,方便阅读。
|
||||
|
||||

|
||||
|
||||
[*进一步了解 在文档里查看YAML元数据.*](https://github.com/blog/1647-viewing-yaml-metadata-in-your-documents)
|
||||
|
||||
### Rendering Tabular Data
|
||||
### 渲染表格数据
|
||||
|
||||
GitHub支持将 `.csv` (comma分隔)和`.tsv` (tab分隔)格式的文件渲染成表格数据。
|
||||
|
||||
@@ -378,7 +378,7 @@ GitHub支持将 `.csv` (comma分隔)和`.tsv` (tab分隔)格式的文件渲染
|
||||
[*进一步了解渲染表格数据.*](https://github.com/blog/1601-see-your-csvs)
|
||||
|
||||
### Diffs
|
||||
#### Rendered prose Diffs
|
||||
#### 可渲染文档的Diffs
|
||||
|
||||
提交和Pull Requests里包含有Github支持的可渲染文档(比如Markdown)会提供*source* 和 *rendered* 两个视图功能。
|
||||
|
||||
@@ -390,21 +390,21 @@ GitHub支持将 `.csv` (comma分隔)和`.tsv` (tab分隔)格式的文件渲染
|
||||
|
||||
[*进一步了解渲染纯文本视图Diffs.*](https://github.com/blog/1784-rendered-prose-diffs)
|
||||
|
||||
#### Diffable Maps
|
||||
#### 可变化地图
|
||||
当你在GitHub上查看一个包含地理数据的提交或pull request时,Github可以显示数据变动的视觉表示。
|
||||
|
||||
[](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5)
|
||||
|
||||
[*进一步了解可比较地图.*](https://github.com/blog/1772-diffable-more-customizable-maps)
|
||||
|
||||
#### Expanding Context in Diffs
|
||||
#### 在diff中折叠与扩展代码
|
||||
你可以通过点击diff边栏里的 *unfold* 按钮来多显示几行上下文。你可以一直点击 *unfold* 按钮直到显示了文件的全部内容。这个功能在所有GitHub产生的diff界面都可以使用。
|
||||
|
||||

|
||||
|
||||
[*进一步了解扩展Diff上下文.*](https://github.com/blog/1705-expanding-context-in-diffs)
|
||||
|
||||
#### Diff or Patch of Pull Request
|
||||
#### 查看Pull Request的diff和patch
|
||||
在Pull Request的URL后面加上 `.diff` 或 `.patch` 的扩展名就可以得到它的diff或patch文件,例如:
|
||||
|
||||
```
|
||||
@@ -444,7 +444,7 @@ $ hub clone tiimgreen/toc
|
||||
|
||||
[*查看更多Hub提供的超酷命令.*](https://github.com/github/hub#commands)
|
||||
|
||||
### Decreasing Contributor Friction
|
||||
### 贡献内容的自动检查
|
||||
假设你想人们使用你的项目并给你的项目做出贡献,你往往需要回答他们常见问题。这个项目是干什么用的?我如何使用它?允许我怎样使用?我如何为项目出力?我怎样配置开发环境?我怎么能保证新功能不会破坏已有的功能?
|
||||
|
||||
[Friction](https://github.com/rafalchmiel/friction)是一个命令行脚本,用来检查你的项目是否[回答了这些问题](https://github.com/rafalchmiel/friction/wiki)。下面是示例输出:
|
||||
@@ -453,7 +453,7 @@ $ hub clone tiimgreen/toc
|
||||
|
||||
*Friction 支持 MRI 2.1.0, MRI 2.0.0 和 MRI 1.9.3.*
|
||||
|
||||
### Contributing Guidelines
|
||||
### 贡献者指南
|
||||
|
||||
在你的仓库的根目录添加一个名为 `CONTRIBUTING` 的文件后,贡献者在新建Issue或Pull Request时会看到这个文件的链接。
|
||||
|
||||
@@ -461,7 +461,7 @@ $ hub clone tiimgreen/toc
|
||||
|
||||
[*进一步了解贡献者指南.*](https://github.com/blog/1184-contributing-guidelines)
|
||||
|
||||
### GitHub Resources
|
||||
### GitHub资源
|
||||
| Title | Link |
|
||||
| ----- | ---- |
|
||||
| GitHub Explore | https://github.com/explore |
|
||||
@@ -470,7 +470,7 @@ $ hub clone tiimgreen/toc
|
||||
| GitHub Training | http://training.github.com/ |
|
||||
| GitHub Developer | https://developer.github.com/ |
|
||||
|
||||
#### Github Talks
|
||||
#### GitHub讨论
|
||||
| Title | Link |
|
||||
| ----- | ---- |
|
||||
| How GitHub Uses GitHub to Build GitHub | https://www.youtube.com/watch?v=qyz3jkOBbQY |
|
||||
@@ -480,7 +480,7 @@ $ hub clone tiimgreen/toc
|
||||
| More Git and GitHub Secrets | https://www.youtube.com/watch?v=p50xsL-iVgU |
|
||||
|
||||
## Git
|
||||
### Previous Branch
|
||||
### 前一个分支
|
||||
快速检出上一个分支:
|
||||
|
||||
```bash
|
||||
@@ -496,7 +496,7 @@ $ git checkout -
|
||||
|
||||
[*进一步了解 Git 分支.*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)
|
||||
|
||||
### Stripspace
|
||||
### Stripspace命令
|
||||
|
||||
Git Stripspace命令可以:
|
||||
|
||||
@@ -512,7 +512,7 @@ $ git stripspace < README.md
|
||||
|
||||
[*进一步了解 Git `stripspace` 命令.*](http://git-scm.com/docs/git-stripspace)
|
||||
|
||||
### Checking out Pull Requests
|
||||
### 检出Pull Requests
|
||||
如果想检出pull requests到本地,可以先用下面的fetch命令:
|
||||
|
||||
```bash
|
||||
@@ -554,7 +554,7 @@ $ git checkout origin/pr/42
|
||||
|
||||
[*进一步了解如何检出pull request到本地.*](https://help.github.com/articles/checking-out-pull-requests-locally)
|
||||
|
||||
### Empty Commits :trollface:
|
||||
### 提交空改动 :trollface:
|
||||
可以使用`--allow-empty`选项强制创建一个没有任何改动的提交:
|
||||
|
||||
```bash
|
||||
@@ -568,7 +568,7 @@ $ git commit -m "Big-ass commit" --allow-empty
|
||||
- 跟使用你仓库的其他人交流。
|
||||
- 作为仓库的第一次提交,因为第一次提交日后是不能被rebase的: `git commit -m "init repo" --allow-empty`.
|
||||
|
||||
### Styled Git Status
|
||||
### 更直观的Git Status
|
||||
在命令行输入如下命令:
|
||||
|
||||
```bash
|
||||
@@ -591,7 +591,7 @@ $ git status -sb
|
||||
|
||||
[*进一步了解 Git `status` 命令.*](http://git-scm.com/docs/git-status)
|
||||
|
||||
### Styled Git Log
|
||||
### 更直观的Git Log
|
||||
输入如下命令:
|
||||
|
||||
```bash
|
||||
@@ -608,7 +608,7 @@ $ git log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s
|
||||
|
||||
[*进一步了解 Git `log` 命令.*](http://git-scm.com/docs/git-log)
|
||||
|
||||
### Git Query
|
||||
### Git查询
|
||||
Git查询运行你在之前的所有提交信息里进行搜索,找到其中和搜索条件相匹配的最近的一条。
|
||||
|
||||
```bash
|
||||
@@ -624,7 +624,7 @@ $ git show :/typo
|
||||
|
||||
* 按 `q` 键退出命令。*
|
||||
|
||||
### Merged Branches
|
||||
### 合并分支
|
||||
输入命令:
|
||||
|
||||
```bash
|
||||
@@ -643,7 +643,7 @@ $ git branch --no-merged
|
||||
|
||||
[*进一步了解 Git `branch` 命令.*](http://git-scm.com/docs/git-branch)
|
||||
|
||||
### Web Server for Browsing Local Repositories
|
||||
### 使用网页查看本地仓库
|
||||
使用Git的 `instaweb` 可以立即在 `gitweb`中浏览你的工作仓库。这个命令是个简单的脚步,配置了`gitweb`和用来浏览本地仓库的Web服务器。*(译者注:默认需要lighttpd支持)*
|
||||
|
||||
```bash
|
||||
@@ -656,10 +656,10 @@ $ git instaweb
|
||||
|
||||
[*进一步了解 Git `instaweb` 命令.*](http://git-scm.com/docs/git-instaweb)
|
||||
|
||||
### Git Configurations
|
||||
### Git配置
|
||||
所有Git配置都保存在你的`.gitconfig` 文件中。
|
||||
|
||||
#### Aliases
|
||||
#### Git命令自定义别名
|
||||
别名用来帮助你定义自己的git命令。比如你可以定义 `git a` 来运行 `git add --all`。
|
||||
|
||||
要添加一个别名, 一种方法是打开 `~/.gitconfig` 文件并添加如下内容:
|
||||
@@ -705,7 +705,7 @@ $ git config --global alias.ac 'add -A . && commit'
|
||||
| `git branches` | `git branch -a` | `git config --global alias.branches 'branch -a'` |
|
||||
| `git remotes` | `git remote -v` | `git config --global alias.remotes 'remote -v'` |
|
||||
|
||||
#### Auto-Correct
|
||||
#### 自动更正
|
||||
如果键入 `git comit` 你会看到如下输出:
|
||||
|
||||
```bash
|
||||
@@ -731,7 +731,7 @@ $ git comit -m "Message"
|
||||
# in 0.1 seconds automatically...
|
||||
```
|
||||
|
||||
#### Color
|
||||
#### 带颜色输出
|
||||
要在你的Git命令输出里加上颜色的话,可以用如下命令:
|
||||
|
||||
```bash
|
||||
@@ -740,7 +740,7 @@ $ git config --global color.ui 1
|
||||
|
||||
[*进一步了解 Git `config` 命令.*](http://git-scm.com/docs/git-config)
|
||||
|
||||
### Git Resources
|
||||
### Git资源
|
||||
| Title | Link |
|
||||
| ----- | ---- |
|
||||
| Official Git Site | http://git-scm.com/ |
|
||||
@@ -755,7 +755,7 @@ $ git config --global color.ui 1
|
||||
| Git for Computer Scientists | http://eagain.net/articles/git-for-computer-scientists/ |
|
||||
| Git Magic | http://www-cs-students.stanford.edu/~blynn/gitmagic/ |
|
||||
|
||||
#### Git Books
|
||||
#### Git参考书籍
|
||||
| Title | Link |
|
||||
| ----- | ---- |
|
||||
| Pragmatic Version Control Using Git | http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git |
|
||||
|
Reference in New Issue
Block a user