diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..6da6f74 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [tiimgreen] diff --git a/.travis.yml b/.travis.yml index 33b2ca3..74e1227 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,9 @@ before_script: - gem install awesome_bot script: - - awesome_bot README.md --allow-dupe --allow-redirect --white-list https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/...,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/ - - awesome_bot README.ko.md --allow-dupe --allow-redirect --white-list https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/...,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/ - - awesome_bot README.ja.md --allow-dupe --allow-redirect --white-list https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/...,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/ - - awesome_bot README.zh-cn.md --allow-dupe --allow-redirect --white-list https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/...,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/ - - awesome_bot README.zh-tw.md --allow-dupe --allow-redirect --white-list https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/...,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/ + - wl=https://github.com/rails/rails/compare/master@,http://git.io/abc123,https://github.com/..,youtube,chrome.google.com/webstore,https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig*,https://github.com/user/repo/compare/,vimeo + - awesome_bot README.md --allow-dupe --allow-redirect --white-list $wl + - awesome_bot README.ko.md --allow-dupe --allow-redirect --white-list $wl + - awesome_bot README.ja.md --allow-dupe --allow-redirect --white-list $wl + - awesome_bot README.zh-cn.md --allow-dupe --allow-redirect --white-list $wl + - awesome_bot README.zh-tw.md --allow-dupe --allow-redirect --white-list $wl diff --git a/README.ja.md b/README.ja.md index f41fd2b..050c863 100644 --- a/README.ja.md +++ b/README.ja.md @@ -81,7 +81,7 @@ GitHub上で差分ページを表示している時、そのURLに`?w=1`を加 [*GitHubの秘密についてもっと詳しく*](https://github.com/blog/967-github-secrets) ### タブ幅の調節 -差分やファイルを表示している時、URLに`?ts=4`を追加するとタブを空白4つの幅で表示する。デフォルトは8つだ。`ts`に指定した数で表示されるということだ。これはGistやrawファイルを表示している時には適用されないが、[Chrome](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)と[Operaの拡張](https://addons.opera.com/en/extensions/details/github-tab-size/)をインストールすることにより、対応することができる。 +差分やファイルを表示している時、URLに`?ts=4`を追加するとタブを空白4つの幅で表示する。デフォルトは8つだ。`ts`に指定した数で表示されるということだ。これはGistやrawファイルを表示している時には適用されないが、[Chrome](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)をインストールすることにより、対応することができる。 例えばGoのソースファイルを表示している時、`?ts=4`を追加する前はこのように表示されるが: @@ -929,8 +929,7 @@ $ git config --global alias.ac 'add -A . && 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 '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | -| `git cleanup` | `git branch --merged | grep -v '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | +| `git cleanup` | `git branch --merged \| grep -v '*' \| xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged \| grep -v '*' \| xargs git branch -d"` | | `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 --"` | @@ -979,7 +978,6 @@ $ git config --global color.ui 1 | 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 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 | diff --git a/README.ko.md b/README.ko.md index c2420f9..0116ba3 100644 --- a/README.ko.md +++ b/README.ko.md @@ -1,6 +1,6 @@ # GitHub 치트 시트 [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) -Git과 GitHub에서 꽤 유용하지만 숨겨져 있는 기능들에 대해 다룹니다. 이 치트 시트는 [Zach Holman](https://github.com/holman)이 Aloha Ruby Conference 2012에서 발표한 [Git과 GitHub의 비밀들](http://confreaks.tv/videos/aloharuby2012-git-and-github-secrets)([슬라이드](https://speakerdeck.com/holman/git-and-github-secrets))과 WDCNZ 2013에서 발표한 [Git과 GitHub에 대한 더 많은 비밀들](https://vimeo.com/72955426)([슬라이드](https://speakerdeck.com/holman/more-git-and-github-secrets))에서 영감을 받아 작성되었습니다. +Git과 GitHub에서 꽤 유용하지만 숨겨져 있는 기능들에 대해 다룹니다. 이 치트 시트는 [Zach Holman](https://github.com/holman)이 Aloha Ruby Conference 2012에서 발표한 [Git과 GitHub의 비밀들](http://confreaks.tv/videos/aloharuby2012-git-and-github-secrets) ([슬라이드](https://speakerdeck.com/holman/git-and-github-secrets))과 WDCNZ 2013에서 발표한 [Git과 GitHub에 대한 더 많은 비밀들](https://vimeo.com/72955426) ([슬라이드](https://speakerdeck.com/holman/more-git-and-github-secrets))에서 영감을 받아 작성되었습니다. *단축주소: [`http://git.io/sheet`](http://git.io/sheet)* @@ -88,7 +88,7 @@ Git과 GitHub에서 꽤 유용하지만 숨겨져 있는 기능들에 대해 다 ### Adjust Tab Space -diff나 파일 URL에 `?ts=4`를 덧붙이면 탭 문자의 크기를 기본값인 공백 8개 대신 4개로 보여줍니다. `ts` 뒤의 숫자는 설정에 맞게 변경 하실 수 있습니다. gist나 raw 파일 보기에는 적용 되지 않습니다만, [크롬 확장 프로그램](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)이나 [오페라 확장 프로그램](https://addons.opera.com/en/extensions/details/github-tab-size/)으로 자동화 할 수 있습니다. +diff나 파일 URL에 `?ts=4`를 덧붙이면 탭 문자의 크기를 기본값인 공백 8개 대신 4개로 보여줍니다. `ts` 뒤의 숫자는 설정에 맞게 변경 하실 수 있습니다. gist나 raw 파일 보기에는 적용 되지 않습니다만, [크롬 확장 프로그램](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)이나 으로 자동화 할 수 있습니다. 여기에 있는 Go 소스 파일은 `?ts=4`를 붙이기 전에는 이렇습니다. @@ -1021,7 +1021,7 @@ $ git config --global alias.ac 'add -A . && 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 '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | +| `git cleanup` | `git branch --merged \| grep -v '*' \| xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged \| grep -v '*' \| xargs git branch -d"` | | `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 --"` | @@ -1075,10 +1075,8 @@ $ git config --global color.ui 1 | 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 Computer Scientists | http://eagain.net/articles/git-for-computer-scientists/ | | Git Magic | http://www-cs-students.stanford.edu/~blynn/gitmagic/ | -| GitHub Training Kit | https://training.github.com/kit/ | | Git Visualization Playground | http://onlywei.github.io/explain-git-with-d3/#freeplay | | Learn Git Branching | http://pcottle.github.io/learnGitBranching/ | | A collection of useful .gitignore templates | https://github.com/github/gitignore | diff --git a/README.md b/README.md index 1d886a1..6b8c9ae 100644 --- a/README.md +++ b/README.md @@ -5,88 +5,93 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c *Read this in other languages: [English](README.md), [한국어](README.ko.md), [日本語](README.ja.md), [简体中文](README.zh-cn.md), [正體中文](README.zh-tw.md).* +GitHub Cheat Sheet is sponsored by [Snapshot: create interactive professional-quality product photos using AI](https://www.snapshotapp.io/) + ## Table of Contents - - [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) - - [Branch](#branch) - - [Compare all Branches to Another Branch](#compare-all-branches-to-another-branch) - - [Comparing Branches](#comparing-branches) - - [Compare Branches across Forked Repositories](#compare-branches-across-forked-repositories) - - [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) - - [Locking Conversations](#locking-conversations) - - [CI Status on Pull Requests](#ci-status-on-pull-requests) - - [Filters](#filters) - - [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) - - [Pasting Clipboard Image to Comments](#pasting-clipboard-image-to-comments) - - [Quick Licensing](#quick-licensing) - - [Task Lists](#task-lists) - - [Task Lists in Markdown Documents](#task-lists-in-markdown-documents) - - [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) - - [Rendering PDF](#rendering-pdf) - - [Revert a Pull Request](#revert-a-pull-request) - - [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) - - [Rendering and diffing images](#rendering-and-diffing-images) - - [Hub](#hub) - - [Contribution Guidelines](#contribution-guidelines) - - [CONTRIBUTING file](#contributing-file) - - [ISSUE_TEMPLATE file](#issue_template-file) - - [PULL_REQUEST_TEMPLATE file](#pull_request_template-file) - - [Octicons](#octicons) - - [GitHub Student Developer Pack](#github-student-developer-pack) - - [GitHub Resources](#github-resources) - - [GitHub Talks](#github-talks) - - [Git](#git) - - [Remove All Deleted Files from the Working Tree](#remove-all-deleted-files-from-the-working-tree) - - [Previous Branch](#previous-branch) - - [Stripspace](#stripspace) - - [SSH keys](#ssh-keys) - - [Checking out Pull Requests](#checking-out-pull-requests) - - [Empty Commits](#empty-commits) - - [Styled Git Status](#styled-git-status) - - [Styled Git Log](#styled-git-log) - - [Git Query](#git-query) - - [Git Grep](#git-grep) - - [Merged Branches](#merged-branches) - - [Fixup and Autosquash](#fixup-and-autosquash) - - [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) - - [Git Videos](#git-videos) - - [Git Articles](#git-articles) + - [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) + - [Branch](#branch) + - [Compare all Branches to Another Branch](#compare-all-branches-to-another-branch) + - [Comparing Branches](#comparing-branches) + - [Compare Branches across Forked Repositories](#compare-branches-across-forked-repositories) + - [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) + - [Locking Conversations](#locking-conversations) + - [CI Status on Pull Requests](#ci-status-on-pull-requests) + - [Filters](#filters) + - [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) + - [Pasting Clipboard Image to Comments](#pasting-clipboard-image-to-comments) + - [Quick Licensing](#quick-licensing) + - [Task Lists](#task-lists) + - [Task Lists in Markdown Documents](#task-lists-in-markdown-documents) + - [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) + - [Rendering PDF](#rendering-pdf) + - [Revert a Pull Request](#revert-a-pull-request) + - [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) + - [Rendering and diffing images](#rendering-and-diffing-images) + - [Hub](#hub) + - [Contribution Guidelines](#contribution-guidelines) + - [CONTRIBUTING file](#contributing-file) + - [ISSUE_TEMPLATE file](#issue_template-file) + - [PULL_REQUEST_TEMPLATE file](#pull_request_template-file) + - [Octicons](#octicons) + - [GitHub Student Developer Pack](#github-student-developer-pack) + - [GitHub Resources](#github-resources) + - [GitHub Talks](#github-talks) + - [SSH keys](#ssh-keys) + - [Profile Image](#profile-image) + - [Repository Templates](#repository-templates) + - [Git](#git) + - [Remove All Deleted Files from the Working Tree](#remove-all-deleted-files-from-the-working-tree) + - [Previous Branch](#previous-branch) + - [Stripspace](#stripspace) + - [Checking out Pull Requests](#checking-out-pull-requests) + - [Empty Commits](#empty-commits) + - [Styled Git Status](#styled-git-status) + - [Styled Git Log](#styled-git-log) + - [Git Query](#git-query) + - [Git Grep](#git-grep) + - [Merged Branches](#merged-branches) + - [Fixup and Autosquash](#fixup-and-autosquash) + - [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) + - [Git Videos](#git-videos) + - [Git Articles](#git-articles) + ## GitHub ### Ignore Whitespace -Adding `?w=1` to any diff URL will remove any changes only in whitespace, enabling you to see only that code that has changed. +Adding `?w=1` to any diff URL will remove any changes only in whitespace, enabling you to see only the code that has changed. ![Diff without whitespace](https://camo.githubusercontent.com/797184940defadec00393e6559b835358a863eeb/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f776869746573706163652e706e67) [*Read more about GitHub secrets.*](https://github.com/blog/967-github-secrets) ### Adjust Tab Space -Adding `?ts=4` to a diff or file URL will display tab characters as 4 spaces wide instead of the default 8. The number after `ts` can be adjusted to suit your preference. This does not work on Gists, or raw file views, but a [Chrome](https://chrome.google.com/webstore/detail/tab-size-on-github/ofjbgncegkdemndciafljngjbdpfmbkn) or [Opera extension](https://addons.opera.com/en/extensions/details/github-tab-size/) can automate this. +Adding `?ts=4` to a diff or file URL will display tab characters as 4 spaces wide instead of the default 8. The number after `ts` can be adjusted to suit your preference. This does not work on Gists, or raw file views, but a [Chrome extension](https://chrome.google.com/webstore/detail/tab-size-on-github/ofjbgncegkdemndciafljngjbdpfmbkn) can automate this. Here is a Go source file before adding `?ts=4`: @@ -116,7 +121,7 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet [*Read more about the Git `clone` command.*](http://git-scm.com/docs/git-clone) -###Branch +### Branch #### Compare all Branches to Another Branch If you go to the repo's [Branches](https://github.com/tiimgreen/github-cheat-sheet/branches) page, next to the Commits button: @@ -138,7 +143,7 @@ To use GitHub to compare branches, change the URL to look like this: https://github.com/{user}/{repo}/compare/{range} ``` -Where `{range} = master...4-1-stable` +where `{range} = master...4-1-stable` For example: @@ -155,7 +160,7 @@ https://github.com/rails/rails/compare/master@{1.day.ago}...master https://github.com/rails/rails/compare/master@{2014-10-04}...master ``` -*Dates are in the format `YYYY-MM-DD`* +*Here, dates are in the format `YYYY-MM-DD`* ![Another compare example](http://i.imgur.com/5dtzESz.png) @@ -188,7 +193,7 @@ https://github.com/rails/rails/compare/byroot:master...master ![Gist](http://i.imgur.com/VkKI1LC.png?1) -Add `.pibb` to the end of any Gist URL ([like this](https://gist.github.com/tiimgreen/10545817.pibb)) in order to get the *HTML only* version suitable for embedding in any other site. +Add `.pibb` to the end of any Gist URL ([like this](https://gist.github.com/tiimgreen/10545817.pibb)) in order to get the *HTML-only* version suitable for embedding in any other site. Gists can be treated as a repository so they can be cloned like any other: @@ -234,9 +239,9 @@ When on a repository page, keyboard shortcuts allow you to navigate easily. - Pressing `t` will bring up a file explorer. - Pressing `w` will bring up the branch selector. - - Pressing `s` will focus the search field for the current repository. Pressing Backspace to delete the “This repository” pill changes the field to search all of GitHub. + - Pressing `s` will focus the search field for the current repository. Pressing ↓ to select the “All GitHub” option changes the field to search all of GitHub. - Pressing `l` will edit labels on existing Issues. - - 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. + - 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. To see all of the shortcuts for the current page press `?`: @@ -245,9 +250,9 @@ To see all of the shortcuts for the current page press `?`: [Read more about search syntax you can use.](https://help.github.com/articles/search-syntax/) ### Line Highlighting in Repositories -Either adding `#L52` to the end of a code file URL or simply clicking the line number will highlight that line number. +Either adding, e.g., `#L52` to the end of a code file URL or simply clicking the line number will highlight that line number. -It also works with ranges, e.g. `#L53-L60`, to select ranges, hold `shift` and click two lines: +It also works with ranges, e.g., `#L53-L60`, to select ranges, hold `shift` and click two lines: ``` https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60 @@ -256,7 +261,7 @@ https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L ![Line Highlighting](http://i.imgur.com/8AhjrCz.png) ### Closing Issues via Commit Messages -If a particular commit fixes an issue, any of the keywords `fix/fixes/fixed`, `close/closes/closed` or `resolve/resolves/resolved`, followed by the issue number, will close the issue once it is committed to the master branch. +If a particular commit fixes an issue, any of the keywords `fix/fixes/fixed`, `close/closes/closed` or `resolve/resolves/resolved`, followed by the issue number, will close the issue once it is committed to the repository's default branch. ```bash $ git commit -m "Fix screwup, fixes #12" @@ -271,7 +276,7 @@ This closes the issue and references the closing commit. ### Cross-Link Issues If you want to link to another issue in the same repository, simply type hash `#` then the issue number, and it will be auto-linked. -To link to an issue in another repository, `{user}/{repo}#ISSUE_NUMBER` e.g. `tiimgreen/toc#12`. +To link to an issue in another repository, `{user}/{repo}#ISSUE_NUMBER`, e.g., `tiimgreen/toc#12`. ![Cross-Link Issues](https://camo.githubusercontent.com/447e39ab8d96b553cadc8d31799100190df230a8/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f7265666572656e6365732e706e67) @@ -478,7 +483,7 @@ Relative links are recommended in your Markdown files when linking to internal c [Link to a file](docs/readme) ``` -Absolute links have to be updated whenever the URL changes (e.g. repository renamed, username changed, project forked). Using relative links makes your documentation easily stand on its own. +Absolute links have to be updated whenever the URL changes (e.g., repository renamed, username changed, project forked). Using relative links makes your documentation easily stand on its own. [*Read more about relative links.*](https://help.github.com/articles/relative-links-in-readmes/) @@ -511,7 +516,7 @@ GitHub supports rendering PDF: [*Read more about rendering PDF.*](https://github.com/blog/1974-pdf-viewing) -###Revert a Pull Request +### Revert a Pull Request After a pull request is merged, you may find it does not help anything or it was a bad decision to merge the pull request. You can revert it by clicking the **Revert** button on the right side of a commit in the pull request page to create a pull request with reverted changes to this specific pull request. @@ -522,7 +527,7 @@ You can revert it by clicking the **Revert** button on the right side of a commi ### Diffs #### Rendered Prose Diffs -Commits and pull requests, including rendered documents supported by GitHub (e.g. Markdown), feature *source* and *rendered* views. +Commits and pull requests, including rendered documents supported by GitHub (e.g., Markdown), feature *source* and *rendered* views. ![Source / Rendered view](https://github-images.s3.amazonaws.com/help/repository/rendered_prose_diff.png) @@ -646,6 +651,7 @@ If you are a student you will be eligible for the GitHub Student Developer Pack. | GitHub Training | https://training.github.com/ | | GitHub Developer | https://developer.github.com/ | | Github Education (Free Micro Account and other stuff for students) | https://education.github.com/ | +| GitHub Best Practices | [Best Practices List](https://www.datree.io/resources/github-best-practices) | #### GitHub Talks | Title | Link | @@ -656,6 +662,40 @@ If you are a student you will be eligible for the GitHub Student Developer Pack. | Git and GitHub Secrets | https://www.youtube.com/watch?v=Foz9yvMkvlA | | More Git and GitHub Secrets | https://www.youtube.com/watch?v=p50xsL-iVgU | +### SSH keys + +You can get a list of public ssh keys in plain text format by visiting: + +``` +https://github.com/{user}.keys +``` + +e.g. [https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys) + +[*Read more about accessing public ssh keys.*](https://changelog.com/github-exposes-public-ssh-keys-for-its-users/) + +### Profile Image + +You can get a user's profile image by visiting: + +``` +https://github.com/{user}.png +``` + +e.g. [https://github.com/tiimgreen.png](https://github.com/tiimgreen.png) + +### Repository Templates + +You can enable templating on your repository which allows anyone to copy the directory structure and files, allowing them to instantly use the files (e.g. for a tutorial or if writing boilerplate code). This can be enabled in the settings of your repository. + +![Convert](https://i.postimg.cc/hGCrVm9F/Template.gif) + +Changing to a template repository will give a new URL endpoint which can be shared and instantly allows users to use your repository as a template. Alternatively, they can go to your repository and click the 'Use as template' button. + +![Template](https://i.postimg.cc/L8PKCHx0/New-Template.gif) + +[*Read more about using repositories as templates*](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/) + ## Git ### Remove All Deleted Files from the Working Tree When you delete a lot of files using `/bin/rm` you can use the following command to remove them from the working tree and from the index, eliminating the need to remove each one individually: @@ -715,23 +755,11 @@ $ git stripspace < README.md [*Read more about the Git `stripspace` command.*](http://git-scm.com/docs/git-stripspace) -### SSH keys - -You can get a list of public ssh keys in plain text format by visiting: - -``` -https://github.com/{user}.keys -``` - -e.g. [https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys) - -[*Read more about accessing public ssh keys.*](https://changelog.com/github-exposes-public-ssh-keys-for-its-users/) - ### Checking out Pull Requests Pull Requests are special branches on the GitHub repository which can be retrieved locally in several ways: -Retrieve a specific Pull Request and store it temporarily in `FETCH_HEAD` for quickly `diff`ing or `merge`ing: +Retrieve a specific Pull Request and store it temporarily in `FETCH_HEAD` for quickly `diff`-ing or `merge`-ing: ```bash $ git fetch origin refs/pull/[PR-Number]/head @@ -803,7 +831,7 @@ Running: $ git status ``` -Produces: +produces: ![git status](http://i.imgur.com/qjPyvXb.png) @@ -813,7 +841,7 @@ By adding `-sb`: $ git status -sb ``` -This is produced: +this is produced: ![git status -sb](http://i.imgur.com/K0OY3nm.png) @@ -826,7 +854,7 @@ Running: $ 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 ``` -Produces: +produces: ![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](http://i.imgur.com/58eOtkW.png) @@ -843,7 +871,7 @@ A Git query allows you to search all your previous commit messages and find the $ git show :/query ``` -Where `query` (case-sensitive) is the term you want to search, this then finds the last one and gives details on the lines that were changed. +where `query` (case-sensitive) is the term you want to search, this then finds the last one and gives details on the lines that were changed. ```bash $ git show :/typo @@ -869,7 +897,7 @@ will show all the files containing the string *aliases*. You can also use multiple flags for more advanced search. For example: - * `-e` The next parameter is the pattern (e.g. regex) + * `-e` The next parameter is the pattern (e.g., regex) * `--and`, `--or` and `--not` Combine multiple patterns. Use it like this: @@ -886,7 +914,7 @@ Running: $ git branch --merged ``` -Will give you a list of all branches that have been merged into your current branch. +will give you a list of all branches that have been merged into your current branch. Conversely: @@ -894,7 +922,7 @@ Conversely: $ git branch --no-merged ``` -Will give you a list of branches that have not been merged into your current branch. +will give you a list of branches that have not been merged into your current branch. [*Read more about the Git `branch` command.*](http://git-scm.com/docs/git-branch) @@ -914,7 +942,7 @@ Use the Git `instaweb` command to instantly browse your working repository in `g $ git instaweb ``` -Opens: +opens: ![Git instaweb](http://i.imgur.com/Dxekmqc.png) @@ -967,14 +995,16 @@ Some useful aliases include: | `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 '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | +| `git cleanup` | `git branch --merged \| grep -v '*' \| xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged \| grep -v '*' \| xargs git branch -d"` | | `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 --"` | *Some Aliases are taken from [@mathiasbynens](https://github.com/mathiasbynens) dotfiles: https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig* #### Auto-Correct -If you type `git comit` you will get this: +Git gives suggestions for misspelled commands and if auto-correct is enabled the command can be fixed and executed automatically. Auto-correct is enabled by specifying an integer which is the delay in tenths of a second before git will run the corrected command. Zero is the default value where no correcting will take place, and a negative value will run the corrected command with no delay. + +For example, if you type `git comit` you will get this: ```bash $ git comit -m "Message" @@ -984,21 +1014,23 @@ $ git comit -m "Message" # commit ``` -To call `commit` when `comit` is typed, just enable auto-correct: +Auto-correct can be enabled like this (with a 1.5 second delay): ```bash -$ git config --global help.autocorrect 1 +$ git config --global help.autocorrect 15 ``` -So now you will get this: +So now the command `git comit` will be auto-corrected to `git commit` like this: ```bash $ git comit -m "Message" # WARNING: You called a Git command named 'comit', which does not exist. # Continuing under the assumption that you meant 'commit' -# in 0.1 seconds automatically... +# in 1.5 seconds automatically... ``` +The delay before git will rerun the command is so the user has time to abort. + #### Color To add more color to your Git output: @@ -1018,13 +1050,13 @@ $ git config --global color.ui 1 | 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 | +| Git God | https://github.com/gorosgobe/git-god | | 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 | https://training.github.com/kit/ | | Git Visualization Playground | http://onlywei.github.io/explain-git-with-d3/#freeplay | | Learn Git Branching | http://pcottle.github.io/learnGitBranching/ | | A collection of useful .gitignore templates | https://github.com/github/gitignore | +| Unixorn's git-extra-commands collection of git scripts | https://github.com/unixorn/git-extra-commands | #### Git Books | Title | Link | @@ -1050,3 +1082,4 @@ $ git config --global color.ui 1 | Title | Link | | ----- | ---- | | GitHub Flow | http://scottchacon.com/2011/08/31/github-flow.html | +| Migrating to Git Large File Storate (Git LFS) | http://vooban.com/en/tips-articles-geek-stuff/migrating-to-git-lfs-for-developing-deep-learning-applications-with-large-files/ | diff --git a/README.zh-cn.md b/README.zh-cn.md index 6ad60e5..9a28341 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -75,7 +75,7 @@ Git 和 Github 秘籍,灵感来自于 [Zach Holman](https://github.com/holman) [*详见 GitHub secrets.*](https://github.com/blog/967-github-secrets) ### 调整 Tab 字符所代表的空格数 -在 diff 或文件的 URL 后面加上 `?ts=4` ,这样当显示 tab 字符的长度时就会是 4 个空格的长度,不再是默认的 8 个空格。 `ts` 后面的数字还可以根据你个人的偏好进行修改。这个技巧不适用于 Gists,或者以 Raw 格式查看文件, 但有浏览器扩展插件可以帮你自动调整: [Chrome 扩展](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn) , [Opera 扩展](https://addons.opera.com/en/extensions/details/github-tab-size/)。 +在 diff 或文件的 URL 后面加上 `?ts=4` ,这样当显示 tab 字符的长度时就会是 4 个空格的长度,不再是默认的 8 个空格。 `ts` 后面的数字还可以根据你个人的偏好进行修改。这个技巧不适用于 Gists,或者以 Raw 格式查看文件, 但有浏览器扩展插件可以帮你自动调整: [Chrome 扩展](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)。 下面以一个 Go 语言源文件为例,看看在 URL 里添加 `?ts=4` 参数的效果。添加前: @@ -105,8 +105,8 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet [*更多对 Git `clone` 命令的介绍.*](http://git-scm.com/docs/git-clone) -###分支 -####将某个分支与其他所有分支进行对比 +### 分支 +#### 将某个分支与其他所有分支进行对比 当你查看某个仓库的分支(Branches)页面(紧挨着 Commits 链接)时 @@ -861,7 +861,7 @@ $ git config --global alias.ac 'add -A . && 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 '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | +| `git cleanup` | `git branch --merged \| grep -v '*' \| xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged \| grep -v '*' \| xargs git branch -d"` | | `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 --"` | @@ -910,7 +910,6 @@ $ git config --global color.ui 1 | 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 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 | diff --git a/README.zh-tw.md b/README.zh-tw.md index 241f6bd..cfc43c2 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -77,7 +77,7 @@ Git 和 Github 秘笈,靈感來自於 [Zach Holman](https://github.com/holman) [*詳見 GitHub secrets.*](https://github.com/blog/967-github-secrets) ### 調整 Tab 字串所代表的空格數 -在 diff 或文件的 URL 後面加上 `?ts=4` ,這樣當顯示 tab 字串的長度時就會是 4 個空格的長度,不再是默認的 8 個空格。 `ts` 後面的數字還可以根據你個人的偏好進行修改。這個技巧不適用於 Gists,或者以 Raw 格式查看文件, 但有瀏覽器擴展插件可以幫你自動調整: [Chrome 擴展](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn) , [Opera 擴展](https://addons.opera.com/en/extensions/details/github-tab-size/)。 +在 diff 或文件的 URL 後面加上 `?ts=4` ,這樣當顯示 tab 字串的長度時就會是 4 個空格的長度,不再是默認的 8 個空格。 `ts` 後面的數字還可以根據你個人的偏好進行修改。這個技巧不適用於 Gists,或者以 Raw 格式查看文件, 但有瀏覽器擴展插件可以幫你自動調整: [Chrome 擴展](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)。 下面以一個 Go 語言原始碼為例,看看在 URL 裡添加 `?ts=4` 參數的效果。添加前: @@ -107,8 +107,8 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet [*更多對 Git `clone` 命令的介紹.*](http://git-scm.com/docs/git-clone) -###分支 -####將某個分支與其他所有分支進行比對 +### 分支 +#### 將某個分支與其他所有分支進行比對 當你查看某個倉庫的分支(Branches)頁面(緊挨著 Commits 連接)時 @@ -905,7 +905,7 @@ $ git config --global alias.ac 'add -A . && 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 '*' | xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d"` | +| `git cleanup` | `git branch --merged \| grep -v '*' \| xargs git branch -d` | `git config --global alias.cleanup "!git branch --merged \| grep -v '*' \| xargs git branch -d"` | | `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 --"` | @@ -954,7 +954,6 @@ $ git config --global color.ui 1 | 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 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 |