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 new file mode 100644 index 0000000..74e1227 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +language: ruby + +rvm: + - 2.2 + +before_script: + - gem install awesome_bot + +script: + - 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 a4accd3..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`を追加する前はこのように表示されるが: @@ -755,8 +755,6 @@ $ git commit -m "Big-ass commit" --allow-empty - リポジトリを利用して誰かと連絡を取りたい時 - リポジトリへの最初のコミットをやり直しできるようにしたい時: `git commit -m "init repo" --allow-empty`. -![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif) - ### Gitステータスのスタイリング 普通に実行すると: @@ -931,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 --"` | @@ -981,8 +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 Designers | 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 | diff --git a/README.ko.md b/README.ko.md index 250b09e..0116ba3 100644 --- a/README.ko.md +++ b/README.ko.md @@ -1,8 +1,8 @@ -# 깃허브 치트 시트 [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) +# GitHub 치트 시트 [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) -A collection of cool hidden and not so 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)). +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))에서 영감을 받아 작성되었습니다. -*Shortlink: [`http://git.io/sheet`](http://git.io/sheet)* +*단축주소: [`http://git.io/sheet`](http://git.io/sheet)* *Read this in other languages: [English](README.md), [한국어](README.ko.md), [日本語](README.ja.md), [简体中文](README.zh-cn.md), [正體中文](README.zh-tw.md).* @@ -25,6 +25,7 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c - [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) @@ -47,7 +48,10 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c - [Diff or Patch of Pull Request](#diff-or-patch-of-pull-request) - [Rendering and diffing images](#rendering-and-diffing-images) - [Hub](#hub) - - [Contributing Guidelines](#contributing-guidelines) + - [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 Resources](#github-resources) - [GitHub Talks](#github-talks) @@ -80,18 +84,18 @@ A collection of cool hidden and not so hidden features of Git and GitHub. This c ![Diff without whitespace](https://camo.githubusercontent.com/797184940defadec00393e6559b835358a863eeb/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f776869746573706163652e706e67) -[*깃허브의 비밀을 더 읽어 보세요.*](https://github.com/blog/967-github-secrets) +[*GitHub의 비밀을 더 읽어 보세요.*](https://github.com/blog/967-github-secrets) ### 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`를 붙이기 전에는 이렇습니다. ![Before, tab space example](http://i.imgur.com/GIT1Fr0.png) 그리고 `?ts=4`를 붙인 다음에는 이렇게 됩니다. - --allow-empty + ![After, tab space example](http://i.imgur.com/70FL4H9.png) ### Commit History by Author @@ -114,9 +118,10 @@ https://github.com/rails/rails/commits/master?author=dhh $ git clone https://github.com/tiimgreen/github-cheat-sheet ``` -[*깃 `clone` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-clone) +[*Git `clone` 명령에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-clone) + +### Branch -###Branch #### Compare all Branches to Another Branch 저장소의 [브랜치](https://github.com/tiimgreen/github-cheat-sheet/branches) 페이지는, 커밋 버튼의 뒤에 있습니다. @@ -127,19 +132,19 @@ https://github.com/{user}/{repo}/branches ... 메인 브랜치에 머지되지 않은 모든 브랜치의 리스트를 볼 수 있습니다. -여기에서 버튼 클릭으로 비교 페이지나 브랜치 삭제를 하실 수 있습니다. +여기에서 버튼 클릭으로 비교 페이지에 접속하거나 브랜치를 삭제할 수 있습니다. ![Compare branches not merged into master in rails/rails repo - https://github.com/rails/rails/branches](http://i.imgur.com/0FEe30z.png) #### Comparing Branches -깃허브에서 브랜치 비교를 하시려면, URL을 이런 식으로 바꾸세요. +GitHub에서 브랜치 비교를 하시려면, URL을 이런 식으로 바꾸세요. ``` https://github.com/{user}/{repo}/compare/{range} ``` -`{range}`는 `master...4-1-stable`식으로 적습니다. +`{range}`는 `master...4-1-stable`과 같이 적습니다. 예를 들어 @@ -149,18 +154,18 @@ https://github.com/rails/rails/compare/master...4-1-stable ![Rails branch compare example](http://i.imgur.com/tIRCOsK.png) -`{range}` 는 이렇게 적을 수도 있습니다. +`{range}`는 이렇게 적을 수도 있습니다. ``` https://github.com/rails/rails/compare/master@{1.day.ago}...master https://github.com/rails/rails/compare/master@{2014-10-04}...master ``` -*날짜는 `YYYY-MM-DD`형식으로 적습니다* +*날짜는 `YYYY-MM-DD` 형식으로 적습니다* ![Another compare example](http://i.imgur.com/5dtzESz.png) -브랜치는 `diff`나 `patch`뷰로도 확인할 수 있습니다. +브랜치는 `diff`나 `patch` 뷰로도 확인할 수 있습니다. ``` https://github.com/rails/rails/compare/master...4-1-stable.diff @@ -171,7 +176,7 @@ https://github.com/rails/rails/compare/master...4-1-stable.patch #### Compare branches across forked repositories -포크된 저장소간의 브랜치를 비교하려면 URL을 이렇게 변경하세요. +포크된 저장소 간의 브랜치를 비교하려면 URL을 이렇게 변경하세요. ``` https://github.com/{user}/{repo}/compare/{foreign-user}:{branch}...{own-branch} @@ -187,13 +192,13 @@ https://github.com/rails/rails/compare/byroot:idempotent-counter-caches...master ### Gists -[Gists](https://gist.github.com/)는 본격적인 저장소를 만들지 않고, 작은 코드 조각과 일할 수 있는 쉬운 방법입니다. +[Gist](https://gist.github.com/)는 본격적인 저장소를 만들지 않고, 작은 코드 조각과 일할 수 있는 쉬운 방법입니다. ![Gist](http://i.imgur.com/VkKI1LC.png?1) -[이렇게](https://gist.github.com/tiimgreen/10545817.pibb) Gist URL뒤에 `.pibb`를 넣으면 다른 사이트에 넣을수 있는 *HTML 온리* 버전을 만들 수 있습니다. +[이렇게](https://gist.github.com/tiimgreen/10545817.pibb) Gist URL 뒤에 `.pibb`를 넣으면 다른 사이트에 첨부할 수 있는 *HTML 온리* 버전을 만들 수 있습니다. -Gists는 저장소처럼 취급할 수 있고 클론도 됩니다. +Gist는 저장소처럼 취급할 수 있고 클론도 됩니다. ```bash $ git clone https://gist.github.com/tiimgreen/10545817 @@ -201,24 +206,25 @@ $ git clone https://gist.github.com/tiimgreen/10545817 ![Gists](http://i.imgur.com/BcFzabp.png) -이는 Gists에서도 수정하고 업데이트를 푸쉬할 수 있다는 의미입니다. +이는 Gists에서도 수정하고 업데이트를 푸시할 수 있다는 의미입니다. ```bash $ git commit +$ git push Username for 'https://gist.github.com': Password for 'https://tiimgreen@gist.github.com': ``` -하지만, Gists는 디랙토리를 지원하지 않습니다. 모든 파일은 저장소의 루트에 넣을 필요가 있습니다. +하지만, Gists는 디렉터리를 지원하지 않습니다. 모든 파일은 저장소의 루트에 넣을 필요가 있습니다. [*Gist를 만드는 법에 대해 더 읽어보세요.*](https://help.github.com/articles/creating-gists) ### Git.io -[Git.io](http://git.io)는 깃허브를 위한 간단한 URL 단축기입니다. +[Git.io](http://git.io)는 GitHub를 위한 간단한 URL 단축기입니다. ![Git.io](http://i.imgur.com/6JUfbcG.png?1) -순수 HTTP에서 Curl으로 사용하실 수도 있습니다. +Curl으로 순수 HTTP를 통해 사용하실 수도 있습니다. ```bash $ curl -i http://git.io -F "url=https://github.com/..." @@ -237,9 +243,9 @@ Location: https://github.com/... 저장소 페이지에서 단축키를 사용하면 쉽게 이동할 수 있습니다. - `t`를 누르면 파일 탐색 페이지로 이동합니다. - - `w`를 누르면 브렌치 선택 페이지로 이동합니다. - - `s`를 누르면 지금 저장소의 검색창이 포커스됩니다. 백스페이스를 누르면 채워져 있는 "This repository"를 지워 GitHub전체에서 검색할 수 있게 됩니다. - - `l`를 누르면 있는 이슈의 라벨을 수정할 수 있습니다. + - `w`를 누르면 브랜치 선택 페이지로 이동합니다. + - `s`를 누르면 현재 저장소의 검색창으로 포커스가 이동합니다. 백스페이스를 누르면 채워져 있는 "This repository"를 지워 GitHub 전체에서 검색할 수 있게 됩니다. + - `l`을 누르면 이슈의 라벨을 수정할 수 있습니다. - __파일을 보고 있을 때__ (예를 들어 `https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md`) `y`를 누르면 URL을 지금 보고 있는 페이지를 사실상 고정하도록 합니다. 코드가 바뀐다고 해도 이번에 본 내용을 다시 볼 수 있습니다. 지금 페이지에서 쓸 수 있는 모든 단축키를 보시려면 `?`를 누르세요. @@ -252,7 +258,7 @@ Location: https://github.com/... 코드 파일 URL의 끝에 `#L52`를 추가하거나 줄 번호를 클릭하면 그 줄 번호를 하이라이트합니다. -`#L53-L60`처럼 범위지정도 가능합니다. 범위를 지정하려면 `shift`키를 누른 채 두 라인을 클릭하면 됩니다. +`#L53-L60`처럼 범위 지정도 가능합니다. 범위를 지정하려면 `shift`키를 누른 채 두 라인을 클릭하면 됩니다. ``` https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60 @@ -268,15 +274,15 @@ https://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L $ git commit -m "Fix screwup, fixes #12" ``` -이렇게 하면 이슈를 닫고 클로징 커맨트로 참조하게 합니다. +이렇게 하면 이슈를 닫고 클로징 커밋으로 참조하게 합니다. ![Closing Repo](http://i.imgur.com/Uh1gZdx.png) -[*커밋 메세지로 이슈 닫기에 대해 더 읽어 보세요.*](https://help.github.com/articles/closing-issues-via-commit-messages) +[*커밋 메시지로 이슈 닫기에 대해 더 읽어 보세요.*](https://help.github.com/articles/closing-issues-via-commit-messages) ### Cross-Link Issues -같은 저장소의 다른 이슈를 링크하기 원한다면, `#`뒤에 이슈 번호만 입력하시면 자동으로 링크됩니다. +같은 저장소의 다른 이슈를 링크하기 원한다면, `#` 뒤에 이슈 번호만 입력하시면 자동으로 링크됩니다. 다른 저장소의 이슈를 링크하고 싶다면 `{user}/{repo}#이슈_번호`로 할 수 있습니다. (예 `tiimgreen/toc#12`) @@ -284,11 +290,11 @@ $ git commit -m "Fix screwup, fixes #12" ### Locking Conversations -풀 리퀘스트와 이슈는 레포지터리의 주인이나 협업자에 의해 잠글 수 있습니다. +풀 리퀘스트와 이슈는 저장소의 주인이나 협업자가 잠글 수 있습니다. ![Lock conversation](https://cloud.githubusercontent.com/assets/2723/3221693/bf54dd44-f00d-11e3-8eb6-bb51e825bc2c.png) -이는 프로젝트의 협업자가 아닌 사람은 더 이상 커맨트를 달 수 없게된다는 말입니다. +이는 프로젝트의 협업자가 아닌 사람은 더 이상 댓글을 달 수 없게 된다는 말입니다. ![Comments locked](https://cloud.githubusercontent.com/assets/2723/3221775/d6e513b0-f00e-11e3-9721-2131cb37c906.png) @@ -296,12 +302,44 @@ $ git commit -m "Fix screwup, fixes #12" ### CI Status on Pull Requests -정확히 설정되었다면, 풀 리퀘스트를 받거나 풀 리퀘스트에 새로운 커밋을 할 때 마다, [Travis CI](https://travis-ci.org/)가 풀 리퀘스트를 빌드 할 것입니다. [Travis CI 시작하기](http://docs.travis-ci.com/user/getting-started/)를 좀 더 읽어보세요. +정확히 설정되었다면, 풀 리퀘스트를 받거나 풀 리퀘스트에 새로운 커밋을 할 때마다, [Travis CI](https://travis-ci.org/)가 풀 리퀘스트를 빌드 할 것입니다. [Travis CI 시작하기](http://docs.travis-ci.com/user/getting-started/)를 좀 더 읽어보세요. [![Travis CI status](https://cloud.githubusercontent.com/assets/1687642/2700187/3a88838c-c410-11e3-9a46-e65e2a0458cd.png)](https://github.com/octokit/octokit.rb/pull/452) [*커밋 상태 API에 대해 좀 더 읽어보세요.*](https://github.com/blog/1227-commit-status-api) +### Filters + +이슈, 풀 리퀘스트 둘 다 유저 인터페이스에서 필터링이 가능합니다. + +레일스 저장소 에서, "activerecord" 라벨을 +선택하여 다음 필터를 만들 수 있습니다. + +`is:issue label:activerecord` + +하지만, activerecord 라벨이 없는 모든 이슈를 찾을 수도 있습니다. + +`is:issue -label:activerecord` + +덧붙여, 풀 리퀘스트에도 동작합니다. + +`is:pr -label:activerecord` + +GitHub는 열리거나 닫힌 이슈와 풀 리퀘스트를 위한 탭이 있습니다만 머지된 +풀 리퀘스트도 볼 수 있습니다. 다음 필터를 입력하기만 하면 됩니다. + +`is:merged` + +[*이슈 검색에 대해 좀 더 읽어보세요.*](https://help.github.com/articles/searching-issues) + +마지막으로 이제 상태 API의 상태에 의한 필터도 가능해졌습니다. + +성공 상태의 풀 리퀘스트는 이렇게 검색합니다. + +`status:success` + +[*상태 API 검색에 대해 좀 더 읽어보세요.*](https://github.com/blog/2014-filter-pull-requests-by-status) + ### Syntax Highlighting in Markdown Files 마크다운에서 예를 들어, 루비 코드를 신텍스 하이라이트 하려면 이렇게 합니다. @@ -322,17 +360,18 @@ table.add_row('Tim Green', 'tiimgreen@gmail.com') puts table.to_s ``` -깃허브는 [Linguist](https://github.com/github/linguist)를 사용해 언어를 감지하고 신텍스를 하이라이트합니다. [언어 YAML 파일](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)을 정독하시면 어떤 키워드가 유효한지 확인하실 수 있습니다. +GitHub는 [Linguist](https://github.com/github/linguist)를 사용해 언어를 감지하고 신택스를 하이라이트합니다. [언어 YAML 파일](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)을 정독하시면 어떤 키워드가 유효한지 확인하실 수 있습니다. -[*깃허브 Flavored 마크다운에 대해 더 읽어 보세요.*](https://help.github.com/articles/github-flavored-markdown) +[*GitHub Flavored 마크다운에 대해 더 읽어 보세요.*](https://help.github.com/articles/github-flavored-markdown) ### Emojis -에모지는 풀 리퀘스트, 이슈, 커밋 메세지, 저장소 설명등에 `:에모지의_이름:`으로 넣을 수 있습니다. +에모지는 풀 리퀘스트, 이슈, 커밋 메시지, 저장소 설명 등에 `:에모지의_이름:`으로 넣을 수 있습니다. -깃허브에서 사용 가능한 에모지의 전 목록은 [emoji-cheat-sheet.com](http://www.emoji-cheat-sheet.com/) 나 [scotch-io/All-Github-Emoji-Icons](https://github.com/scotch-io/All-Github-Emoji-Icons)에서 확인하실 수 있습니다. +GitHub에서 사용 가능한 에모지의 전 목록은 [emoji-cheat-sheet.com](http://www.emoji-cheat-sheet.com/)나 [scotch-io/All-GitHub-Emoji-Icons](https://github.com/scotch-io/All-GitHub-Emoji-Icons)에서 확인하실 수 있습니다. +편리한 에모지 검색 엔진은 [emoji.muan.co](http://emoji.muan.co/)에 있습니다. -깃허브에서 많이 사용하는 에모지 탑 5위는 이렇습니다. +GitHub에서 많이 사용하는 에모지 탑 5위는 이렇습니다. 1. `:shipit:` 2. `:sparkles:` @@ -342,7 +381,7 @@ puts table.to_s ### Images/GIFs -커맨트나 README등등에 이미지와 GIF를 넣을 수 있습니다. +댓글이나 README 등에 이미지와 GIF를 넣을 수 있습니다. ``` ![Alt Text](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif) @@ -356,11 +395,11 @@ puts table.to_s ![Peter don't care](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif) -모든 이미지는 GitHub에서 케쉬합니다. 그래서 호스트가 죽어도 이미지는 여전히 남습니다. +모든 이미지는 GitHub에서 캐시합니다. 그래서 호스트가 죽어도 이미지는 여전히 남습니다. #### Embedding Images in GitHub Wiki -이미지를 위키 페이지에넣는 방법은 여럿 있습니다. 위에 보이는 일반 마크다운 문법도 있지만, 이미지에 높이와 넓이를 지정할 수 있는 문법도 있습니다. +이미지를 위키 페이지에 넣는 방법은 여럿 있습니다. 위에 보이는 일반 마크다운 문법도 있지만, 이미지에 높이와 넓이를 지정할 수 있는 문법도 있습니다. ```markdown [[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]] @@ -372,7 +411,7 @@ puts table.to_s ### Quick Quoting -스레드에 답글들 때 전에 누가 말한 어떤 내용을 인용하고 싶다면, 텍스트를 하이라이트하고 `r`을 누르세요. 이렇게 하면 내용을 텍스트 박스에 인용 포맷으로 복사해 줍니다. +스레드에 답글을 달 때 전에 누가 말한 어떤 내용을 인용하고 싶다면, 텍스트를 하이라이트하고 `r`을 누르세요. 이렇게 하면 내용을 텍스트 박스에 인용 포맷으로 복사해 줍니다. ![Quick Quote](https://f.cloud.github.com/assets/296432/124483/b0fa6204-6ef0-11e2-83c3-256c37fa7abc.gif) @@ -382,7 +421,7 @@ puts table.to_s _(크롬에서만 동작합니다)_ -스크린샷을 찍고 클립보드에 있는 경우 (mac: `cmd-ctrl-shift-4`), 간단히 이미지를 커맨트 색션에 붙여넣기(`cmd-v / ctrl-v`)할 수 있고 이는 자동으로 깃허브에 업로드 됩니다. +스크린샷을 찍고 클립보드에 복사한 경우 (mac: `cmd-ctrl-shift-4`), 간단히 이미지를 댓글 영역에 붙여넣을(`cmd-v / ctrl-v`) 수 있고 이는 자동으로 GitHub에 업로드 됩니다. ![Pasting Clipboard Image to Comments](https://cloud.githubusercontent.com/assets/39191/5794265/39c9b65a-9f1b-11e4-9bc7-04e41f59ea5f.png) @@ -390,7 +429,7 @@ _(크롬에서만 동작합니다)_ ### Quick Licensing -저장소를 만들 때, 깃허브는 만들어진 저작권을 추가할 수 있는 옵션을 제공합니다. +저장소를 만들 때, GitHub는 만들어진 저작권을 추가할 수 있는 옵션을 제공합니다. ![License](http://i.imgur.com/Chqj4Fg.png) @@ -405,7 +444,7 @@ _(크롬에서만 동작합니다)_ ### Task Lists -이슈와 풀 리퀘스트에서 밑의 문법으로 체크박스를 넣을 수 있습니다.(스페이스에 주의하세요.) +이슈와 풀 리퀘스트에서 아래의 문법으로 체크박스를 넣을 수 있습니다.(스페이스에 주의하세요.) ``` - [ ] Be awesome @@ -418,7 +457,7 @@ _(크롬에서만 동작합니다)_ ![Task List](http://i.imgur.com/jJBXhsY.png) -체크박스가 클릭 되면, 순수 마크다운에서 갱신이 이루어집니다. +체크박스를 클릭하면, 순수 마크다운에서 갱신이 이루어집니다. ``` - [x] Be awesome @@ -429,38 +468,42 @@ _(크롬에서만 동작합니다)_ - [ ] Sleep ``` -[*테스크 리스트에 대해 더 읽어 보세요.*](https://help.github.com/articles/writing-on-github#task-lists) +[*할 일 목록에 대해 더 읽어 보세요.*](https://help.github.com/articles/writing-on-github#task-lists) #### Task Lists in Markdown Documents + 이제 마크다운 문서에서 **읽기 전용** 체크리스트를 넣을 수 있습니다. ``` - [ ] Mercury - [x] Venus - [x] Earth + - [x] Moon - [x] Mars -- [ ] Jupiter + - [ ] Deimos + - [ ] Phobos ``` - [ ] Mercury - [x] Venus - [x] Earth + - [x] Moon - [x] Mars -- [ ] Jupiter + - [ ] Deimos + - [ ] Phobos -[*마크다운 문서에서의 테스크 리스트에 대해 더 읽어 보세요.*](https://github.com/blog/1825-task-lists-in-all-markdown-documents) +[*마크다운 문서에서의 할 일 목록에 대해 더 읽어 보세요.*](https://github.com/blog/1825-task-lists-in-all-markdown-documents) ### Relative Links -상대 경로 링크는 마크다운 파일이 내부 컨텐츠로 링크될 때 추천합니다. +상대 경로 링크는 마크다운 파일이 내부 콘텐츠로 링크될 때 추천합니다. ```markdown [Link to a header](#awesome-section) - [Link to a file](docs/readme) ``` -절대 경로 링크는 URL이 변경 될 때 마다 변경해야 합니다. (예를 들어 저장소 이름 변경, 유저이름 변경, 프로젝트 포크) +절대 경로 링크는 URL이 변경 될 때마다 변경해야 합니다. (예를 들어 저장소 이름 변경, 아이디 변경, 프로젝트 포크) 상대 경로 링크를 사용하면 문서를 쉽게 스스로 독립적으로 만들 수 있습니다. [*상대 경로 링크에 대해 더 읽어 보세요.*](https://help.github.com/articles/relative-links-in-readmes) @@ -469,13 +512,13 @@ _(크롬에서만 동작합니다)_ 지킬로 작성된 페이지와 포스트에서, 저장소 정보는 예를 들어 `{{ site.github.project_title }}`처럼 `site.github` 이름 공간으로 사용하고 표시할 수 있습니다. -Jemoji와 jekyll-mentions플러그인은 GitHub.com에서 처럼 [emoji](#emojis)와 [@mentions](https://github.com/blog/821)을 지킬 포스트와 페이지에서 사용하게 합니다. +Jemoji와 jekyll-mentions 플러그인은 GitHub.com에서처럼 [emoji](#emojis)와 [@mentions](https://github.com/blog/821)를 지킬 포스트와 페이지에서 사용하게 합니다. -[*저장소 메타 데이타와 깃허브 페이지의 플러그인 지원에 대해 더 읽어 보세요.*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages) +[*저장소 메타 데이터와 GitHub 페이지의 플러그인 지원에 대해 더 읽어 보세요.*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages) ### Viewing YAML Metadata in your Documents -[Jekyll](http://jekyllrb.com/)이나 [GitHub Pages](http://pages.github.com/)같은 많은 블로그에서 포스트의 처음에 YAML 포멧의 메타데이터를 필요로 합니다. 깃허브는 이 메타 정보를 읽기 편하게 테이블로 표시해 줍니다. +[Jekyll](http://jekyllrb.com/)이나 [GitHub Pages](http://pages.github.com/) 같은 많은 블로그에서 포스트의 처음에 YAML 포멧의 메타데이터를 필요로 합니다. GitHub는 이 메타 정보를 읽기 편하게 테이블로 표시해 줍니다. ![YAML metadata](https://camo.githubusercontent.com/47245aa16728e242f74a9a324ce0d24c0b916075/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f36343035302f313232383236372f65303439643063362d323761302d313165332d396464382d6131636432323539393334342e706e67) @@ -483,15 +526,15 @@ Jemoji와 jekyll-mentions플러그인은 GitHub.com에서 처럼 [emoji](#emojis ### Rendering Tabular Data -깃허브는 `.csv` (comma-separated) 와 `.tsv` (tab-separated)파일에 대해 표(tabular) 데이터 보기를 지원합니다. +GitHub는 `.csv`(comma-separated)와 `.tsv`(tab-separated) 파일에 대해 표(tabular) 데이터 보기를 지원합니다. ![Tabular data](https://camo.githubusercontent.com/1b6dd0157ffb45d9939abf14233a0cb13b3b4dfe/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f3238323735392f3937363436322f33323038336463652d303638642d313165332d393262322d3566323863313061353035392e706e67) -[*표 데이타 표시에 대해 더 읽어 보세요.*](https://github.com/blog/1601-see-your-csvs) +[*표 데이터 표시에 대해 더 읽어 보세요.*](https://github.com/blog/1601-see-your-csvs) ### Rendering PDF -깃허브에서 PDF를 렌더링할 수 있습니다. +GitHub에서 PDF를 렌더할 수 있습니다. ![PDF](https://cloud.githubusercontent.com/assets/1000669/7492902/f8493160-f42e-11e4-8cea-1cb4f02757e7.png) @@ -502,20 +545,21 @@ Jemoji와 jekyll-mentions플러그인은 GitHub.com에서 처럼 [emoji](#emojis 풀 리퀘스트가 머지된 후에, 아무 도움이 안되거나 머지가 잘못된 결정이었다는 걸 눈치 챌 때가 있습니다. -풀 리퀘스트 페이지의 커밋의 오른 쪽에 있는 **Revert** 버튼을 클릭하면 이 풀리퀘스트를 되돌리는 풀리퀘스트를 만들어 되돌릴 수 있습니다. +풀 리퀘스트 페이지의 커밋의 오른쪽에 있는 **Revert** 버튼을 클릭하면 이 풀 리퀘스트를 되돌리는 풀 리퀘스트를 만들어 되돌릴 수 있습니다. ![Revert button](https://camo.githubusercontent.com/0d3350caf2bb1cba53123ffeafc00ca702b1b164/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f68656c702f70756c6c5f72657175657374732f7265766572742d70756c6c2d726571756573742d6c696e6b2e706e67) [*풀 리퀘스트 되돌리기에 대해 더 읽어 보세요.*](https://github.com/blog/1857-introducing-the-revert-button) ### Diffs + #### Rendered Prose Diffs GitHub에서 지원하는 산문(prose) 파일(예를 들어 Markdown)이 있는 커밋과 풀 리퀘스트에서는 *source*와 *rendered* 뷰 기능을 사용할 수 있습니다. ![Source / Rendered view](https://github-images.s3.amazonaws.com/help/repository/rendered_prose_diff.png) -"rendered" 버튼을 클릭하시면 렌더된 문서에서 변경을 확인하실 수 있습니다. 렌더된 산문(prose) 뷰는 문장을 추가, 삭제, 변경했을때 유용합니다. +"rendered" 버튼을 클릭하시면 렌더된 문서에서 변경을 확인하실 수 있습니다. 렌더된 산문(prose) 뷰는 문장을 추가, 삭제, 변경했을 때 유용합니다. ![Rendered Prose Diffs](https://f.cloud.github.com/assets/17715/2003056/3997edb4-862b-11e3-90be-5e9586edecd7.png) @@ -523,7 +567,7 @@ GitHub에서 지원하는 산문(prose) 파일(예를 들어 Markdown)이 있는 #### Diffable Maps -지오데이타가 포함된 커밋이나 풀 리퀘스트를 볼 때마다 깃허브는 무엇이 변경 되었는지 시각적으로 보여줍니다. +지오데이터가 포함된 커밋이나 풀 리퀘스트를 볼 때마다 GitHub는 무엇이 변경 되었는지 시각적으로 보여줍니다. [![Diffable Maps](https://f.cloud.github.com/assets/282759/2090660/63f2e45a-8e97-11e3-9d8b-d4c8078b004e.gif)](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5) @@ -531,7 +575,7 @@ GitHub에서 지원하는 산문(prose) 파일(예를 들어 Markdown)이 있는 #### Expanding Context in Diffs -diff의 닫아둔 곳의 *펼침* 버튼을 클릭하면, 문맥을 더 볼 수 있습니다. 전채 파일을 표시할때까지 계속 *펼칠* 수 있으며, 깃허브에서 diff가 표시되는 장소라면 어디서든 사용가능합니다. +diff의 닫아둔 곳의 *펼침* 버튼을 클릭하면, 문맥을 더 볼 수 있습니다. 전체 파일을 표시할 때까지 계속 *펼칠* 수 있으며, GitHub에서 diff가 표시되는 장소라면 어디서든 사용가능합니다. ![Expanding Context in Diffs](https://f.cloud.github.com/assets/22635/1610539/863c1f64-5584-11e3-82bf-151b406a272f.gif) @@ -539,7 +583,7 @@ diff의 닫아둔 곳의 *펼침* 버튼을 클릭하면, 문맥을 더 볼 수 #### Diff or Patch of Pull Request -URL뒤에 `.diff` 나 `.patch`를 붙이면 풀 리퀘스트의 diff를 얻을 수 있습니다. +URL 뒤에 `.diff`나 `.patch`를 붙이면 풀 리퀘스트의 diff를 얻을 수 있습니다. 예를 들면 ``` @@ -571,7 +615,7 @@ index 88fcf69..8614873 100644 #### Rendering and diffing images -깃허브는 PNG, JPG, GIF, PSD를 포함한 여러 일반 적인 이미지 형식을 표시할 수 있습니다. 추가적으로 이미지 형식의 diff를 표시하는 여러 방법을 제공합니다. +GitHub는 PNG, JPG, GIF, PSD를 포함한 여러 일반적인 이미지 형식을 표시할 수 있습니다. 추가적으로 이미지 형식의 diff를 표시하는 여러 방법을 제공합니다. [![Diffable PSD](https://cloud.githubusercontent.com/assets/2546/3165594/55f2798a-eb56-11e3-92e7-b79ad791a697.gif)](https://github.com/blog/1845-psd-viewing-diffing @@ -579,7 +623,7 @@ index 88fcf69..8614873 100644 ### Hub -[Hub](https://github.com/github/hub)는 깃허브를 좀 더 쉽게 사용할 수 있도록 추가 기능 및 명령을 제공하는 커맨드 라인 깃 래퍼입니다. +[Hub](https://github.com/github/hub)는 GitHub를 좀 더 쉽게 사용할 수 있도록 추가 기능 및 명령을 제공하는 커맨드 라인 Git 래퍼입니다. 이렇게 할 수 있습니다. @@ -589,21 +633,44 @@ $ hub clone tiimgreen/toc [*Hub가 제공하는 더 멋진 기능들을 확인해 보세요.*](https://github.com/github/hub#commands) -### Contributing Guidelines +### Contribution Guidelines -저장소의 제일 위에 `CONTRIBUTING` 파일을 넣어두면 기여자가 이슈를 만들거나 풀 리퀘스트를 만들 때 링크로 보여줍니다. +GitHub는 프로젝트에 기여하는 사용자를 위한 세 가지 각기 다른 파일을 지원합니다. +이 파일은 저장소의 제일 위나 그 아래의 `.github` 디렉터리에 위치할 수 있습니다. + +### CONTRIBUTING File + +저장소의 제일 위나 그 아래의 `.github` 디렉터리에 `CONTRIBUTING`이나 `CONTRIBUTING.md` 파일을 넣어두면 기여자가 이슈를 만들거나 풀 리퀘스트를 만들 때 링크로 보여줍니다. ![Contributing Guidelines](https://camo.githubusercontent.com/71995d6b0e620a9ef1ded00a04498241c69dd1bf/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f736b697463682f6973737565732d32303132303931332d3136323533392e6a7067) [*기여하기에 대해 더 읽어 보세요.*](https://github.com/blog/1184-contributing-guidelines) +### ISSUE_TEMPLATE file + +프로젝트의 새로운 이슈에 사용될 템플릿을 지정할 수 있습니다. 사용자가 새 이슈를 생성하면 이슈 창이 이 파일의 내용으로 채워집니다. 저장소의 제일 위나 그 아래의 `.github` 디렉터리에 `ISSUE_TEMPLATE`이나 `ISSUE_TEMPLATE.md` 파일을 넣어 두세요. + +[*이슈 템플릿에 대해 더 읽어 보세요.*](https://github.com/blog/2111-issue-and-pull-request-templates) + +[이슈 템플릿 파일 생성기](https://www.talater.com/open-source-templates/) + +![GitHub Issue template](https://cloud.githubusercontent.com/assets/25792/13120859/733479fe-d564-11e5-8a1f-a03f95072f7a.png) + +### PULL_REQUEST_TEMPLATE file + +프로젝트의 새로운 풀 리퀘스트에 사용될 템플릿을 지정할 수 있습니다. 사용자가 새 풀 리퀘스트를 생성하면 텍스트 영역이 이 파일의 내용으로 채워집니다. 저장소의 제일 위나 `.github` 디렉터리에 `PULL_REQUEST_TEMPLATE`이나 `PULL_REQUEST_TEMPLATE.md` 파일을 넣어 두세요. + +[*풀 리퀘스트 템플릿에 대해 더 읽어 보세요.*](https://github.com/blog/2111-issue-and-pull-request-templates) + +[풀 리퀘스트 템플릿 파일 생성기](https://www.talater.com/open-source-templates/) + ### Octicons -깃허브 아이콘(옥티콘)이 이제 오픈소스가 되었습니다. +GitHub 아이콘(옥티콘)이 이제 오픈소스가 되었습니다. ![Octicons](https://og.github.com/octicons/octicons@1200x630.png) -[*깃 허브의 옥티콘에 대해 더 읽어보세요.*](https://octicons.github.com) +[*GitHub 옥티콘에 대해 더 읽어보세요.*](https://octicons.github.com) ### GitHub Resources @@ -614,6 +681,7 @@ $ hub clone tiimgreen/toc | GitHub Help | https://help.github.com/ | | 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 Talks @@ -641,8 +709,8 @@ $ git rm $(git ls-files -d) $ git status On branch master Changes not staged for commit: - deleted: a - deleted: c + deleted: a + deleted: c $ git rm $(git ls-files -d) rm 'a' @@ -651,19 +719,13 @@ rm 'c' $ git status On branch master Changes to be committed: - deleted: a - deleted: c + deleted: a + deleted: c ``` ### Previous Branch -커맨드 라인에서 이전 디렉터리로 이동하려면 이렇게 합니다. - -```bash -$ cd - -``` - -비슷하게, 깃에서 마지막 브랜치로 돌아가는 건 이렇게 할 수 있습니다. +Git에서 이전 브랜치로 돌아가는 건 이렇게 할 수 있습니다. ```bash $ git checkout - @@ -676,11 +738,11 @@ $ git checkout - # Switched to branch 'master' ``` -[*깃 브랜치에 대해 더 읽어 보세요.*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging) +[*Git 브랜치에 대해 더 읽어 보세요.*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging) ### Stripspace -깃 Stripspace는 이런 일을 합니다. +Git Stripspace는 이런 일을 합니다. - 줄 끝의 공백을 제거 - 빈줄을 줄임 @@ -692,26 +754,26 @@ $ git checkout - $ git stripspace < README.md ``` -[*깃 `stripspace` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-stripspace) +[*Git `stripspace` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-stripspace) ### SSH keys -밑의 주소를 방문하면 공개 ssh 키의 목록을 일반 텍스트 형식으로 볼 수 있습니다. +아래 주소를 방문하면 공개 ssh 키의 목록을 일반 텍스트 형식으로 볼 수 있습니다. ``` https://github.com/{user}.keys ``` -e.g. [https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys) +예: [https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys) [*공개 ssh 키 접근에 대해 더 읽어 보세요.*](https://changelog.com/github-exposes-public-ssh-keys-for-its-users/) ### Checking out Pull Requests -풀 리퀘스트는 깃허브 저장소에서 사용하는 특별한 브랜치로 여러 방법으로 로컬로 -가져 올수 있습니다. +풀 리퀘스트는 GitHub 저장소에서 사용하는 특별한 브랜치로 여러 방법으로 로컬로 +가져올 수 있습니다. -빠르게 `diff`나 `merge`를 하기위해 특정 풀 리퀘스트를 임시로 `FETCH_HEAD`로 +빠르게 `diff`나 `merge`를 하기 위해 특정 풀 리퀘스트를 임시로 `FETCH_HEAD`로 가져오려면 이렇게 합니다. ```bash @@ -748,7 +810,7 @@ $ git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*' $ git checkout pr/42 pr-42 ``` -여러 저장소를 다루어야 한다면, 전역 깃 설정에서 풀 리퀘스트를 받을(fetching) 수 있도록 설정 할 수 도 있습니다. +여러 저장소를 다루어야 한다면, 전역 Git 설정에서 풀 리퀘스트를 받을(fetching) 수 있도록 설정 할 수도 있습니다. ```bash git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*" @@ -779,9 +841,7 @@ $ git commit -m "Big-ass commit" --allow-empty - 한 뭉치의 일을 시작하기 전에 주석으로 사용 - 코드와 관련없는 프로젝트 수정을 할때 주석으로 사용 - 저장소를 사용하는 사람과의 대화 - - 나중에 리베이스하지 않을 저장소의 첫 커밋으로 사용 `git commit -m "init repo" --allow-empty`. - -![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif) + - 저장소의 첫 커밋으로 사용 `git commit -m "Initial commit" --allow-empty` ### Styled Git Status @@ -791,15 +851,17 @@ $ git status ![git status](http://i.imgur.com/qjPyvXb.png) -이렇게 바뀝니다. +`-sb`를 추가하면 ```bash $ git status -sb ``` +이렇게 바뀝니다. + ![git status -sb](http://i.imgur.com/K0OY3nm.png) -[*깃 `status` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-status) +[*Git `status` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-status) ### Styled Git Log @@ -813,15 +875,15 @@ $ git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %C ![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) -[Palesz](http://stackoverflow.com/users/88355/palesz)님 고맙습니다. +[Palesz](http://stackoverflow.com/users/88355/palesz) 님 고맙습니다. -NOTE: 이 명령을 알리아스 (단축 명령)으로 넣을 수 있습니다. [여기](#aliases)의 소개를 보세요. +NOTE: 이 명령을 알리아스(단축 명령)로 넣을 수 있습니다. [여기](#aliases)의 소개를 보세요. -[*깃 `log` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-log) +[*Git `log` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-log) ### Git Query -깃 쿼리는 모든 이전 커밋 메시지에서 검색해 가장 최근의 쿼리에 맞는 커밋을 찾아줍니다. +Git 쿼리는 모든 이전 커밋 메시지에서 검색해 가장 최근의 쿼리에 맞는 커밋을 찾아줍니다. ```bash $ git show :/query @@ -835,33 +897,35 @@ $ git show :/typo ![git show :/query](http://i.imgur.com/icaGiNt.png) -NOTE: 나오려면 `q`를 누르세요. +*나오려면 `q`를 누르세요.* ### Git Grep -Git Grep은 패턴에 매치하는 줄의 목록을 반환합니다. +Git Grep은 패턴과 일치하는 줄의 목록을 반환합니다. 다음 명령을 실행해 보세요. + ```bash $ git grep aliases ``` + *aliases* 문자열이 포함된 모든 파일을 보여줍니다. ![git grep aliases](http://i.imgur.com/DL2zpQ9.png) *나오려면 `q`를 누르세요.* -여러 플레그를 이용해서 좀 더 복잡한 검색을 할 수 있습니다. 예를 들면, +여러 플래그를 이용해서 좀 더 복잡한 검색을 할 수 있습니다. 예를 들면, * `-e` 다음 파라미터는 패턴 (e.g. regex) - * `--and`, `--or`, `--not` 으로 여러 패턴을 조합 + * `--and`, `--or`, `--not`으로 여러 패턴을 조합 이렇게 사용할 수 있습니다. ```bash $ git grep -e pattern --and -e anotherpattern ``` -[*깃 `grep` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-grep) +[*Git `grep` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-grep) ### Merged Branches @@ -879,23 +943,23 @@ $ git branch --no-merged 이 명령어는 현재 브랜치에 머지되지 않은 브랜치의 목록을 보여줍니다. -[*깃 `branch` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-branch) +[*Git `branch` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-branch) ### Fixup and Autosquash -이전(HEAD의 한개 이상 전의) 커밋에 잘못된 부분이 있다면, 예를들어 `abcde`라면, +이전(HEAD의 한 개 이상 전의) 커밋에 잘못된 부분이 있다면, 예를 들어 `abcde`라면, 문제를 수정하고 밑의 커맨드를 입력해 고칠 수 있습니다. ```bash $ git commit --fixup=abcde $ git rebase abcde^ --autosquash -i ``` -[*깃 `commit` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-commit) -[*깃 `rebase` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-rebase) +[*Git `commit` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-commit) +[*Git `rebase` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-rebase) ### Web Server for Browsing Local Repositories -깃 `instaweb` 커맨드을 사용하면, 즉석에서 `gitweb`안에서 작업중인 저장소를 둘러 볼 +Git `instaweb` 커맨드을 사용하면, 즉석에서 `gitweb` 안에서 작업중인 저장소를 둘러 볼 수 있습니다. 이 커맨드는 `gitweb`과 로컬 저장소를 브라우징 하기 위한 웹 서버를 설정하는 스크립트입니다. ```bash @@ -906,7 +970,7 @@ Opens: ![Git instaweb](http://i.imgur.com/Dxekmqc.png) -[*깃 `instaweb` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-instaweb) +[*Git `instaweb` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-instaweb) ### Git Configurations @@ -914,19 +978,19 @@ Opens: #### Aliases -알리아스는 커스텀 깃 명령어를 등록할 수 있는 핼퍼입니다. 예를 들어 `git a`로 `git add --all`를 실행하게 할 수 있습니다. +알리아스는 커스텀 Git 명령어를 등록할 수 있는 헬퍼입니다. 예를 들어 `git a`로 `git add --all`를 실행하게 할 수 있습니다. -알리아스를 추가하려면 `~/.gitconfig`를 찾아 다음 포멧으로 입력하거나 +알리아스를 추가하려면 `~/.gitconfig`를 찾아 다음 포맷으로 입력하거나 ``` [alias] - co = checkout - cm = commit - p = push - # Show verbose output about tags, branches or remotes - tags = tag -l - branches = branch -a - remotes = remote -v + co = checkout + cm = commit + p = push + # Show verbose output about tags, branches or remotes + tags = tag -l + branches = branch -a + remotes = remote -v ``` 커맨드 라인에서 다음 명령을 입력합니다. @@ -935,19 +999,19 @@ Opens: $ git config --global alias.new_alias git_function ``` -예를들면 +예를 들면 ```bash $ git config --global alias.cm commit ``` -NOTE: 여러 함수를 알리아스하려면 따옴표를 이용하세요. +여러 함수를 알리아스하려면 따옴표를 이용하세요. ```bash $ git config --global alias.ac 'add -A . && commit' ``` -여기 몇 가지 권장 알리아스가 있습니다. +여기 몇 가지 유용한 알리아스가 있습니다. | Alias | Current Command | What to Type | | --- | --- | --- | @@ -957,11 +1021,11 @@ $ 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 --"` | -*일부 알리아스는 [@mathiasbynens](https://github.com/mathiasbynens)님의 dotfiles에서 가져왔습니다.(https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig)* +*일부 알리아스는 [@mathiasbynens](https://github.com/mathiasbynens) 님의 dotfiles에서 가져왔습니다.(https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig)* #### Auto-correct @@ -972,7 +1036,7 @@ $ git comit -m "Message" # git: 'comit' is not a git command. See 'git --help'. # Did you mean this? -# commit +# commit ``` `comit`을 쳤을 때 `commit`을 부르려면, 자동 교정을 켜두세요. @@ -992,13 +1056,13 @@ $ git comit -m "Message" #### Color -깃 커맨드 라인에 색을 넣으려면 이렇게 하세요. +Git 커맨드 라인에 색을 넣으려면 이렇게 하세요. ```bash $ git config --global color.ui 1 ``` -[*깃 `config` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-config) +[*Git `config` 커맨드에 대해 더 읽어 보세요.*](http://git-scm.com/docs/git-config) ### Git Resources @@ -1011,12 +1075,11 @@ $ 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 Designers | 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 | +| Learn Git Branching | http://pcottle.github.io/learnGitBranching/ | +| A collection of useful .gitignore templates | https://github.com/github/gitignore | #### Git Books @@ -1029,3 +1092,19 @@ $ git config --global color.ui 1 | 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 | + +#### Git Videos + +| Title | Link | +| ----- | ---- | +| Linus Torvalds on Git | https://www.youtube.com/watch?v=4XpnKHJAok8 | +| Introduction to Git with Scott Chacon | https://www.youtube.com/watch?v=ZDR433b0HJY | +| Git From the Bits Up | https://www.youtube.com/watch?v=MYP56QJpDr4 | +| Graphs, Hashes, and Compression, Oh My! | https://www.youtube.com/watch?v=ig5E8CcdM9g | +| GitHub Training & Guides | https://www.youtube.com/watch?list=PLg7s6cbtAD15G8lNyoaYDuKZSKyJrgwB-&v=FyfwLX4HAxM | + +#### Git Articles + +| Title | Link | +| ----- | ---- | +| GitHub Flow | http://scottchacon.com/2011/08/31/github-flow.html | diff --git a/README.md b/README.md index 091dd0a..6b8c9ae 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,97 @@ # GitHub Cheat Sheet [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) -A collection of cool hidden and not so 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)). +A collection of cool hidden and not so hidden features of Git and GitHub. This cheat sheet was inspired by [Zach Holman](https://github.com/holman)'s [Git and GitHub Secrets](http://confreaks.tv/videos/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)). *Shortlink: [`http://git.io/sheet`](http://git.io/sheet)* *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) - - [Contributing Guidelines](#contributing-guidelines) - - [Octicons](#octicons) - - [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) + - [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/github-tab-size/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`: @@ -99,7 +110,7 @@ https://github.com/rails/rails/commits/master?author=dhh ![DHH commit history](http://i.imgur.com/S7AE29b.png) -[*Read more about the differences between commits views.*](https://help.github.com/articles/differences-between-commit-views) +[*Read more about the differences between commits views.*](https://help.github.com/articles/differences-between-commit-views/) ### Cloning a Repository When cloning a repository the `.git` can be left off the end. @@ -110,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: @@ -132,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: @@ -149,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) @@ -160,7 +171,7 @@ https://github.com/rails/rails/compare/master...4-1-stable.diff https://github.com/rails/rails/compare/master...4-1-stable.patch ``` -[*Read more about comparing commits across time.*](https://help.github.com/articles/comparing-commits-across-time) +[*Read more about comparing commits across time.*](https://help.github.com/articles/comparing-commits-across-time/) #### Compare Branches across Forked Repositories To use GitHub to compare branches across forked repositories, change the URL to look like this: @@ -182,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: @@ -202,7 +213,7 @@ Password for 'https://tiimgreen@gist.github.com': ``` However, Gists do not support directories. All files need to be added to the repository root. -[*Read more about creating Gists.*](https://help.github.com/articles/creating-gists) +[*Read more about creating Gists.*](https://help.github.com/articles/creating-gists/) ### Git.io [Git.io](http://git.io) is a simple URL shortener for GitHub. @@ -228,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 `?`: @@ -239,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 @@ -250,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" @@ -260,12 +271,12 @@ This closes the issue and references the closing commit. ![Closing Repo](http://i.imgur.com/Uh1gZdx.png) -[*Read more about closing Issues via commit messages.*](https://help.github.com/articles/closing-issues-via-commit-messages) +[*Read more about closing Issues via commit messages.*](https://help.github.com/articles/closing-issues-via-commit-messages/) ### 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) @@ -309,7 +320,7 @@ can also see merged pull requests. Just put the following in the filter: `is:merged` -[*Read more about searching issues.*](https://help.github.com/articles/searching-issues) +[*Read more about searching issues.*](https://help.github.com/articles/searching-issues/) Finally, github now allows you to filter by the Status API's status. @@ -340,7 +351,7 @@ puts table.to_s GitHub uses [Linguist](https://github.com/github/linguist) to perform language detection and syntax highlighting. You can find out which keywords are valid by perusing the [languages YAML file](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). -[*Read more about GitHub Flavored Markdown.*](https://help.github.com/articles/github-flavored-markdown) +[*Read more about GitHub Flavored Markdown.*](https://help.github.com/articles/github-flavored-markdown/) ### Emojis Emojis can be added to Pull Requests, Issues, commit messages, repository descriptions, etc. using `:name_of_emoji:`. @@ -399,7 +410,7 @@ After taking a screenshot and adding it to the clipboard (mac: `cmd-ctrl-shift-4 ![Pasting Clipboard Image to Comments](https://cloud.githubusercontent.com/assets/39191/5794265/39c9b65a-9f1b-11e4-9bc7-04e41f59ea5f.png) -[*Read more about issue attachments.*](https://help.github.com/articles/issue-attachments) +[*Read more about issue attachments.*](https://help.github.com/articles/issue-attachments/) ### Quick Licensing When creating a repository, GitHub gives you the option of adding in a pre-made license: @@ -412,7 +423,7 @@ You can also add them to existing repositories by creating a new file through th Also works for `.gitignore`. -[*Read more about open source licensing.*](https://help.github.com/articles/open-source-licensing) +[*Read more about open source licensing.*](https://help.github.com/articles/open-source-licensing/) ### Task Lists In Issues and Pull requests check boxes can be added with the following syntax (notice the space): @@ -439,7 +450,7 @@ When they are clicked, they will be updated in the pure Markdown: - [ ] Sleep ``` -[*Read more about task lists.*](https://help.github.com/articles/writing-on-github#task-lists) +[*Read more about task lists.*](https://help.github.com/articles/writing-on-github/#task-lists) #### Task Lists in Markdown Documents In full Markdown documents **read-only** checklists can now be added using the following syntax: @@ -472,9 +483,9 @@ 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) +[*Read more about relative links.*](https://help.github.com/articles/relative-links-in-readmes/) ### Metadata and Plugin Support for GitHub Pages Within Jekyll pages and posts, repository information is available within the `site.github` namespace, and can be displayed, for example, using `{{ site.github.project_title }}`. @@ -484,7 +495,7 @@ The Jemoji and jekyll-mentions plugins enable [emoji](#emojis) and [@mentions](h [*Read more about repository metadata and plugin support for GitHub Pages.*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages) ### Viewing YAML Metadata in your Documents -Many blogging websites, like [Jekyll](http://jekyllrb.com/) with [GitHub Pages](http://pages.github.com/), depend on some YAML-formatted metadata at the beginning of your post. GitHub will render this metadata as a horizontal table, for easier reading +Many blogging websites, like [Jekyll](http://jekyllrb.com/) with [GitHub Pages](https://pages.github.com), depend on some YAML-formatted metadata at the beginning of your post. GitHub will render this metadata as a horizontal table, for easier reading ![YAML metadata](https://camo.githubusercontent.com/47245aa16728e242f74a9a324ce0d24c0b916075/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f36343035302f313232383236372f65303439643063362d323761302d313165332d396464382d6131636432323539393334342e706e67) @@ -505,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. @@ -516,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) @@ -576,7 +587,7 @@ GitHub can display several common image formats, including PNG, JPG, GIF, and PS [![Diffable PSD](https://cloud.githubusercontent.com/assets/2546/3165594/55f2798a-eb56-11e3-92e7-b79ad791a697.gif)](https://github.com/blog/1845-psd-viewing-diffing) -[*Read more about rendering and diffing images.*](https://help.github.com/articles/rendering-and-diffing-images) +[*Read more about rendering and diffing images.*](https://help.github.com/articles/rendering-and-diffing-images/) ### Hub [Hub](https://github.com/github/hub) is a command line Git wrapper that gives you extra features and commands that make working with GitHub easier. @@ -589,13 +600,33 @@ $ hub clone tiimgreen/toc [*Check out some more cool commands Hub has to offer.*](https://github.com/github/hub#commands) -### Contributing Guidelines -Adding a `CONTRIBUTING` file to the root of your repository will add a link to your file when a contributor creates an Issue or opens a Pull Request. +### Contribution Guidelines +GitHub supports adding 3 different files which help users contribute to your project. +These files can either be placed in the root of your repository or a `.github` directory under the root. + +#### CONTRIBUTING File +Adding a `CONTRIBUTING` or `CONTRIBUTING.md` file to either the root of your repository or a `.github` directory will add a link to your file when a contributor creates an Issue or opens a Pull Request. ![Contributing Guidelines](https://camo.githubusercontent.com/71995d6b0e620a9ef1ded00a04498241c69dd1bf/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f736b697463682f6973737565732d32303132303931332d3136323533392e6a7067) [*Read more about contributing guidelines.*](https://github.com/blog/1184-contributing-guidelines) +#### ISSUE_TEMPLATE file +You can define a template for all new issues opened in your project. The content of this file will pre-populate the new issue box when users create new issues. Add an `ISSUE_TEMPLATE` or `ISSUE_TEMPLATE.md` file to either the root of your repository or a `.github` directory. + +[*Read more about issue templates.*](https://github.com/blog/2111-issue-and-pull-request-templates) + +[Issue template file generator](https://www.talater.com/open-source-templates/) + +![GitHub Issue template](https://cloud.githubusercontent.com/assets/25792/13120859/733479fe-d564-11e5-8a1f-a03f95072f7a.png) + +#### PULL_REQUEST_TEMPLATE file +You can define a template for all new pull requests opened in your project. The content of this file will pre-populate the text area when users create pull requests. Add a `PULL_REQUEST_TEMPLATE` or `PULL_REQUEST_TEMPLATE.md` file to either the root of your repository or a `.github` directory. + +[*Read more about pull request templates.*](https://github.com/blog/2111-issue-and-pull-request-templates) + +[Pull request template file generator](https://www.talater.com/open-source-templates/) + ### Octicons GitHubs icons (Octicons) have now been open sourced. @@ -603,6 +634,13 @@ GitHubs icons (Octicons) have now been open sourced. [*Read more about GitHub's Octicons*](https://octicons.github.com) +### GitHub Student Developer Pack + +If you are a student you will be eligible for the GitHub Student Developer Pack. This gives you free credit, free trials and early access to software that will help you when developing. + +![GitHub Student Developer Pack](http://i.imgur.com/9ru3K43.png) + +[*Read more about GitHub's Student Developer Pack*](https://education.github.com/pack) ### GitHub Resources | Title | Link | @@ -613,6 +651,7 @@ GitHubs icons (Octicons) have now been open sourced. | 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 | @@ -623,6 +662,40 @@ GitHubs icons (Octicons) have now been open sourced. | 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: @@ -682,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 @@ -747,7 +808,7 @@ git fetch origin git checkout pr/42 ``` -[*Read more about checking out pull requests locally.*](https://help.github.com/articles/checking-out-pull-requests-locally) +[*Read more about checking out pull requests locally.*](https://help.github.com/articles/checking-out-pull-requests-locally/) ### Empty Commits Commits can be pushed with no code changes by adding `--allow-empty`: @@ -761,9 +822,7 @@ Some use-cases for this (that make sense), include: - Annotating the start of a new bulk of work or a new feature. - Documenting when you make changes to the project that aren't code related. - Communicating with people using your repository. - - The first commit of a repo, as the first commit cannot be rebased later: `git commit -m "init repo" --allow-empty`. - -![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif) + - The first commit of a repository: `git commit -m "Initial commit" --allow-empty`. ### Styled Git Status Running: @@ -772,7 +831,7 @@ Running: $ git status ``` -Produces: +produces: ![git status](http://i.imgur.com/qjPyvXb.png) @@ -782,7 +841,7 @@ By adding `-sb`: $ git status -sb ``` -This is produced: +this is produced: ![git status -sb](http://i.imgur.com/K0OY3nm.png) @@ -795,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) @@ -812,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 @@ -838,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: @@ -855,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: @@ -863,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) @@ -883,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) @@ -936,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" @@ -953,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: @@ -987,20 +1050,36 @@ $ 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 Designers | http://hoth.entp.com/output/git_for_designers.html | +| 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 | http://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 | | ----- | ---- | -| Pragmatic Version Control Using Git | http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git | +| Pragmatic Version Control Using Git | https://pragprog.com/titles/tsgit/pragmatic-version-control-using-git | | Pro Git | http://git-scm.com/book | | Git Internals PluralSight | https://github.com/pluralsight/git-internals-pdf | -| Git in the Trenches | http://cbx33.github.com/gitt/ | +| Git in the Trenches | http://cbx33.github.io/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 | +| Pragmatic Guide to Git | https://pragprog.com/titles/pg_git/pragmatic-guide-to-git | +| Git: Version Control for Everyone | https://www.packtpub.com/application-development/git-version-control-everyone | + +#### Git Videos +| Title | Link | +| ----- | ---- | +| Linus Torvalds on Git | https://www.youtube.com/watch?v=4XpnKHJAok8 | +| Introduction to Git with Scott Chacon | https://www.youtube.com/watch?v=ZDR433b0HJY | +| Git From the Bits Up | https://www.youtube.com/watch?v=MYP56QJpDr4 | +| Graphs, Hashes, and Compression, Oh My! | https://www.youtube.com/watch?v=ig5E8CcdM9g | +| GitHub Training & Guides | https://www.youtube.com/watch?list=PLg7s6cbtAD15G8lNyoaYDuKZSKyJrgwB-&v=FyfwLX4HAxM | + +#### Git Articles +| 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 d93427d..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 链接)时 @@ -717,8 +717,6 @@ $ git commit -m "Big-ass commit" --allow-empty - 跟使用你仓库的其他人交流。 - 作为仓库的第一次提交,因为第一次提交后不能被 rebase: `git commit -m "init repo" --allow-empty`. - ![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif) - ### 美化 Git Status 在命令行输入如下命令: @@ -863,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 --"` | @@ -912,8 +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 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 | @@ -924,7 +920,7 @@ $ git config --global color.ui 1 | ----- | ---- | | 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 Internals Pluralsight | https://github.com/pluralsight/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 | diff --git a/README.zh-tw.md b/README.zh-tw.md index 817f0d6..cfc43c2 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -50,11 +50,13 @@ Git 和 Github 秘笈,靈感來自於 [Zach Holman](https://github.com/holman) - [從工作區去除大量已刪除文件](#從工作區去除大量已刪除文件) - [上一個分支](#上一個分支) - [去除空白](#去除空白) + - [SSH 金鑰](#ssh-金鑰) - [檢出 Pull Requests](#檢出-pull-requests) - [沒有任何改動的提交](#沒有任何改動的提交) - [美化 Git Status](#美化-git-status) - [美化 Git Log](#美化-git-log) - [Git 查詢](#git-查詢) + - [Git Grep](#git-grep) - [合併分支](#合併分支) - [修復有問題的提交以及自動合併](#修復有問題的提交以及自動合併) - [以網站方式查看本地倉庫](#以網站方式查看本地倉庫) @@ -75,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` 參數的效果。添加前: @@ -105,8 +107,8 @@ $ git clone https://github.com/tiimgreen/github-cheat-sheet [*更多對 Git `clone` 命令的介紹.*](http://git-scm.com/docs/git-clone) -###分支 -####將某個分支與其他所有分支進行比對 +### 分支 +#### 將某個分支與其他所有分支進行比對 當你查看某個倉庫的分支(Branches)頁面(緊挨著 Commits 連接)時 @@ -649,7 +651,21 @@ $ git stripspace < README.md [*進一步了解 Git `stripspace` 命令.*](http://git-scm.com/docs/git-stripspace) +### SSH 金鑰 + +您可以藉由下面網址得到全部公開的 ssh 金鑰: + +``` +https://github.com/{user}.keys +``` + +範例:[https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys) + +[*更多詳細 SSH 金鑰資訊...*](https://changelog.com/github-exposes-public-ssh-keys-for-its-users/) + + ### 檢出 Pull Requests + 對 Github 倉庫來說,Pull Request 是種特殊分支, 可以通過以下多種方式取到本地: 取出某個特定的 Pull Request 並臨時作為本地的 `FETCH_HEAD` 中以便進行快速查看更改( diff )以及合併( merge ): @@ -717,8 +733,6 @@ $ git commit -m "Big-ass commit" --allow-empty - 跟使用你倉庫的其他人交流。 - 作為倉庫的第一次提交,因為第一次提交後不能被 rebase: `git commit -m "init repo" --allow-empty`. - ![It ain't even that trolololol...](http://i.minus.com/il1jaw.gif) - ### 美化 Git Status 在命令行輸入如下命令: @@ -775,7 +789,35 @@ $ git show :/typo * 按 `q` 鍵退出命令。* +### Git Grep + +Git Grep 將顯示匹配字串的行號。 + +執行: + +```bash +$ git grep aliases +``` +會找出檔案內有出現 *aliases* 字串。 + +![git grep aliases](http://i.imgur.com/DL2zpQ9.png) + +* 按 `q` 結束搜尋* + +你也可以使用多重 flags 來達到進階搜尋。範例: + + * `-e` 下一個搜尋匹配條件 (e.g. regex) + * `--and`, `--or` and `--not` 合併多重匹配字串. + +使用如下: +```bash + $ git grep -e pattern --and -e anotherpattern +``` + +[*更多詳細 Git `grep` 指令介紹*](http://git-scm.com/docs/git-grep) + ### 合併分支 + 輸入命令: ```bash @@ -863,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 --"` | @@ -912,8 +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 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 | @@ -924,7 +964,7 @@ $ git config --global color.ui 1 | ----- | ---- | | 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 Internals Pluralsight | https://github.com/pluralsight/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 |