8000 Merge branch 'master' of https://github.com/tiimgreen/github-cheat-sheet · hail2u/github-cheat-sheet@b8ea0a3 · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit b8ea0a3

Browse files
author
Kyo Nagashima
committed
2 parents 922e0ae + 8f6c719 commit b8ea0a3

File tree

2 files changed

+57
-38
lines changed

2 files changed

+57
-38
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,20 @@
1212
## New Feature
1313
```
1414
- Add new feature in Contents Menu in correct position
15+
- For internal links e.g. Contents use relative links:
16+
```
17+
- [Ignore Whitespace](#ignore-whitespace)
18+
```
19+
Not:
20+
```
21+
- [Ignore Whitespace](https://github.com/tiimgreen/github-cheat-sheet#ignore-whitespace)
22+
```
1523
- Add examples wherever possible
1624
- Use `bash` styling for all git commands:
1725
```bash
1826
$ git commit -m "Message"
1927
```
28+
```bash
29+
$ git commit -m "Message"
30+
```
2031
- Add links to Git docs or GitHub docs wherever possible

README.md

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
# GitHub Cheat Sheet
22

3-
All the hidden and not hidden features of Git and GitHub. This cheat sheet was inspired by Zach Holman's [Git and GitHub Secrets](http://www.confreaks.com/videos/1229-aloharuby2012-git-and-github-secrets) talk at Aloha Ruby Conference 2012 ([slides](https://speakerdeck.com/holman/git-and-github-secrets)) and his [More Git and GitHub Secrets](https://vimeo.com/72955426) talk at WDCNZ 2013 ([slides](https://speakerdeck.com/holman/more-git-and-github-secrets)).
3+
All the hidden and not hidden features of Git and GitHub. This cheat sheet was inspired by [Zach Holman](https://github.com/holman)'s [Git and GitHub Secrets](http://www.confreaks.com/videos/1229-aloharuby2012-git-and-github-secrets) talk at Aloha Ruby Conference 2012 ([slides](https://speakerdeck.com/holman/git-and-github-secrets)) and his [More Git and GitHub Secrets](https://vimeo.com/72955426) talk at WDCNZ 2013 ([slides](https://speakerdeck.com/holman/more-git-and-github-secrets)).
44

55
# Contents
66

7-
- [Ignore Whitespace](https://github.com/tiimgreen/github-cheat-sheet#ignore-whitespace)
8-
- [Cloning a Repo](https://github.com/tiimgreen/github-cheat-sheet#cloning-a-repo)
9-
- [Hub - Git Wrapper](https://github.com/tiimgreen/github-cheat-sheet#hub---git-wrapper)
10-
- [Previous Branch](https://github.com/tiimgreen/github-cheat-sheet#previous-branch)
11-
- [git.io](https://github.com/tiimgreen/github-cheat-sheet#gitio)
12-
- [Gists](https://github.com/tiimgreen/github-cheat-sheet#gists)
13-
- [Keyboard Shortcuts](https://github.com/tiimgreen/github-cheat-sheet#keyboard-shortcuts)
14-
- [Closing Issues with Commits](https://github.com/tiimgreen/github-cheat-sheet#closing-issues-with-commits)
15-
- [Checking out Pull Requests](https://github.com/tiimgreen/github-cheat-sheet#checking-out-pull-requests)
16-
- [Cross-Link Issues](https://github.com/tiimgreen/github-cheat-sheet#cross-link-issues)
17-
- [Syntax Highlighting in Markdown Files](https://github.com/tiimgreen/github-cheat-sheet#syntax-highlighting-in-markdown-files)
18-
- [Commit History by Author](https://github.com/tiimgreen/github-cheat-sheet#commit-history-by-author)
19-
- [Empty Commits](https://github.com/tiimgreen/github-cheat-sheet#empty-commits)
20-
- [Comparing Branches](https://github.com/tiimgreen/github-cheat-sheet#comparing-branches)
21-
- [Line Highlighting in Repos](https://github.com/tiimgreen/github-cheat-sheet#line-highlighting-in-repos)
22-
- [Emojis](https://github.com/tiimgreen/github-cheat-sheet#emojis)
23-
- [Images/GIFs](https://github.com/tiimgreen/github-cheat-sheet#imagesgifs)
24-
- [Quick Quoting](https://github.com/tiimgreen/github-cheat-sheet#quick-quoting)
25-
- [Styled Git Status](https://github.com/tiimgreen/github-cheat-sheet#styled-git-status)
26-
- [Styled Git Log](https://github.com/tiimgreen/github-cheat-sheet#styled-git-log)
27-
- [Git Query](https://github.com/tiimgreen/github-cheat-sheet#git-query)
28-
- [Merged Branches](https://github.com/tiimgreen/github-cheat-sheet#merged-branches)
29-
- [Quick Licensing](https://github.com/tiimgreen/github-cheat-sheet#quick-licensing)
30-
- [TODO Lists](https://github.com/tiimgreen/github-cheat-sheet#todo-lists)
31-
- [.gitconfig Recommendations](https://github.com/tiimgreen/github-cheat-sheet#gitconfig-recommendations)
32-
- [Aliases](https://github.com/tiimgreen/github-cheat-sheet#aliases)
33-
- [Auto-correct](https://github.com/tiimgreen/github-cheat-sheet#auto-correct)
34-
- [Color](https://github.com/tiimgreen/github-cheat-sheet#color)
7+
- [Ignore Whitespace](#ignore-whitespace)
8+
- [Cloning a Repo](#cloning-a-repo)
9+
- [Hub - Git Wrapper](#hub---git-wrapper)
10+
- [Previous Branch](#previous-branch)
11+
- [git.io](#gitio)
12+
- [Gists](#gists)
13+
- [Keyboard Shortcuts](#keyboard-shortcuts)
14+
- [Closing Issues with Commits](#closing-issues-with-commits)
15+
- [Checking out Pull Requests](#checking-out-pull-requests)
16+
- [Cross-Link Issues](#cross-link-issues)
17+
- [Syntax Highlighting in Markdown Files](#syntax-highlighting-in-markdown-files)
18+
- [Commit History by Author](#commit-history-by-author)
19+
- [Empty Commits](#empty-commits)
20+
- [Comparing Branches](#comparing-branches)
21+
- [Line Highlighting in Repos](#line-highlighting-in-repos)
22+
- [Emojis](#emojis)
23+
- [Images/GIFs](#imagesgifs)
24+
- [Quick Quoting](#quick-quoting)
25+
- [Styled Git Status](#styled-git-status)
26+
- [Styled Git Log](#styled-git-log)
27+
- [Git Query](#git-query)
28+
- [Merged Branches](#merged-branches)
29+
- [Quick Licensing](#quick-licensing)
30+
- [TODO Lists](#todo-lists)
31+
- [.gitconfig Recommendations](#gitconfig-recommendations)
32+
- [Aliases](#aliases)
33+
- [Auto-correct](#auto-correct)
34+
- [Color](#color)
3535

3636
## Ignore Whitespace
3737

3838
Adding `?w=1` to any diff URL will remove any changes only in whitespace, enabling you to see only that code that has changed.
3939

4040
## Cloning a Repo
4141

42-
When cloning a repo the `.git` can be left off the edge.
42+
When cloning a repo the `.git` can be left off the end.
4343

4444
```bash
4545
$ git clone https://github.com/tiimgreen/github-cheat-sheet
4646
```
4747

4848
## Hub - Git Wrapper
4949

50-
[Hub](https://github.com/github/hub) is a command line tool that wraps git in order to extend it with extra features and commands that make working with GitHub easier.
50+
[Hub](https://github.com/github/hub) is a command line git wrapper that gives extra features and commands that make working with GitHub easier.
5151

5252
This allows you to do things like:
5353

5454
```bash
5555
$ hub clone tiimgreen/toc
5656
```
5757

58-
Which translates to:
58+
instead of:
5959

6060
```bash
61-
$ git clone git://github.com/tiimgreen/toc.git
61+
$ git clone https://github.com/tiimgreen/toc.git
6262
```
6363

6464
## Previous Branch
@@ -77,6 +77,9 @@ $ git checkout -
7777

7878
$ git checkout -
7979
# Switched to branch 'next'
80+
81+
$ git checkout -
82+
# Switched to branch 'master'
8083
```
8184

8285
## git.io
@@ -108,7 +111,7 @@ Pressing `s` will select the search bar.
108111

109112
Pressing `y` __when looking at a file__ (e.g. `https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md`) will change your URL to one which, in effect, freezes the page you are looking at. If this code changes, you will still be able to see what you saw at that current time.
110113

111-
To see all of the shortcuts for the current page type `shift+?`
114+
To see all of the shortcuts for the current page press `?`.
112115

113116
## Closing Issues with Commits
114117

@@ -122,7 +125,7 @@ This closes the issue and references the closing commit.
122125

123126
![Closing Repo](http://i.imgur.com/URXFprQ.png)
124127

125-
## Checking out pull requests
128+
## Checking out Pull Requests
126129

127130
If you want to check out pull request locally, you can fetch it using that command:
128131

@@ -234,9 +237,9 @@ which allows you to see the difference on the master branch up a set time ago or
234237

235238
## Line Highlighting in Repos
236239

237-
Adding `#L52` to the end of a code file URL will highlight that line number.
240+
Either adding `#L52` to the end of a code file URL or simply clicking the lin number will highlight that line number.
238241

239-
It also works with ranges, e.g. `#L53-L60`:
242+
It also works with ranges, e.g. `#L53-L60`, to select ranges, hold `shift` and click two lines:
240243

241244
```
242245
https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60
@@ -278,7 +281,7 @@ Images and GIFs can be added to comments, READMEs etc.:
278281
![Alt Text](http://image_url.com/image.jpg)
279282
```
280283

281-
![Jim Carrey](http://wac.450f.edgecastcdn.net/80450F/thefw.com/files/2013/05/Irene.gif)
284+
![Chuck Norris](http://gifs.joelglovier.com/chuck-norris/chuck-norris.gif)
282285

283286
All images are cached on GitHub, so if your host goes down, the image will remain available.
284287

@@ -415,6 +418,7 @@ Some recommendations include:
415418
| Alias | Current Command | What to Type |
416419
| --- | --- | --- |
417420
| `git cm` | `git commit` | `git config --global alias.cm commit` |
421+
| `git co` | `git checkout` | `git config --global alias.co checkout` |
418422
| `git ac` | `git add . -A` `git commit` | `git config --global alias.ac '!git add -A && git commit'` |
419423
| `git st` | `git status -sb` | `git config --global alias.st 'status -sb'` |
420424

@@ -451,3 +455,7 @@ To add more colour to your git command line:
451455
```bash
452456
$ git config --global color.ui 1
453457
```
458+
459+
# Sharing
460+
461+
Share on [Twitter](https://twitter.com/intent/tweet?source=webclient&text=http%3A%2F%2Fgithub.com%2Ftiimgreen%2Fgithub-cheat-sheet%20-%20GitHub%20Cheat%20Sheet)

0 commit comments

Comments
 (0)
0