{"id":347,"url":"https://github.com/tiimgreen/github-cheat-sheet","last_synced_at":"2025-10-05T18:31:06.605Z","repository":{"id":15966138,"uuid":"18708860","full_name":"tiimgreen/github-cheat-sheet","owner":"tiimgreen","description":"A list of cool features of Git and GitHub.","archived":false,"fork":false,"pushed_at":"2024-04-15T20:15:56.000Z","size":776,"stargazers_count":45721,"open_issues_count":36,"forks_count":5254,"subscribers_count":1392,"default_branch":"master","last_synced_at":"2024-05-01T21:35:53.194Z","etag":null,"topics":["awesome","awesome-list","git","github","list"],"latest_commit_sha":null,"homepage":"http://git.io/sheet","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tiimgreen.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["tiimgreen"]}},"created_at":"2014-04-12T16:38:42.000Z","updated_at":"2024-05-05T06:32:42.830Z","dependencies_parsed_at":"2022-07-10T14:32:39.489Z","dependency_job_id":"9affff3e-e15d-4cdc-afcc-830ed30a7b2e","html_url":"https://github.com/tiimgreen/github-cheat-sheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiimgreen%2Fgithub-cheat-sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiimgreen%2Fgithub-cheat-sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiimgreen%2Fgithub-cheat-sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiimgreen%2Fgithub-cheat-sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiimgreen","download_url":"https://codeload.github.com/tiimgreen/github-cheat-sheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235418595,"owners_count":18987133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["awesome","awesome-list","git","github","list"],"created_at":"2024-01-05T20:12:52.486Z","updated_at":"2025-10-05T18:31:06.141Z","avatar_url":"https://github.com/tiimgreen.png","language":null,"readme":"# GitHubカンニング・ペーパー [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)\nこれはGitやGitHubの隠された機能やよく知られていない機能の一覧だ。[Zach Holman](https://github.com/holman)によるAloha Ruby Conference 2012での[Git and GitHub Secrets](https://github.com/tiimgreen/github-cheat-sheet)（[スライド](https://github.com/tiimgreen/github-cheat-sheet)）とWDCNZ 2013での[More Git and GitHub Secrets](https://vimeo.com/72955426)（[スライド](https://speakerdeck.com/holman/more-git-and-github-secrets)）の二つのトークを元にしている。\n\n*短縮URL: [`http://git.io/sheet`](http://git.io/sheet)*\n\n*Read this in other languages: [English](README.md), [한국어](README.ko.md), [日本語](README.ja.md), [简体中文](README.zh-cn.md), [正體中文](README.zh-tw.md).*\n\n# 目次\n- [GitHub](#github)\n  - [空白の無視](#%E7%A9%BA%E7%99%BD%E3%81%AE%E7%84%A1%E8%A6%96)\n  - [タブ幅の調節](#%E3%82%BF%E3%83%96%E5%B9%85%E3%81%AE%E8%AA%BF%E7%AF%80)\n  - [特定のユーザーによるコミット履歴](#%E7%89%B9%E5%AE%9A%E3%81%AE%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%81%AB%E3%82%88%E3%82%8B%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88%E5%B1%A5%E6%AD%B4)\n  - [リポジトリのクローン](#%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%81%AE%E3%82%AF%E3%83%AD%E3%83%BC%E3%83%B3)\n  - [ブランチ](#%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81)\n    - [全ブランチを別のブランチと比較](#%E5%85%A8%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E3%82%92%E5%88%A5%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E3%81%A8%E6%AF%94%E8%BC%83)\n    - [ブランチ同士の比較](#%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E5%90%8C%E5%A3%AB%E3%81%AE%E6%AF%94%E8%BC%83)\n    - [フォークされたリポジトリ間でのブランチ比較](#%E3%83%95%E3%82%A9%E3%83%BC%E3%82%AF%E3%81%95%E3%82%8C%E3%81%9F%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E9%96%93%E3%81%A7%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81%E6%AF%94%E8%BC%83)\n  - [Gists](#gists)\n  - [Git.io](#gitio)\n  - [キーボード・ショートカット](#%E3%82%AD%E3%83%BC%E3%83%9C%E3%83%BC%E3%83%89%E3%82%B7%E3%83%A7%E3%83%BC%E3%83%88%E3%82%AB%E3%83%83%E3%83%88)\n  - [コードの指定行の強調](#%E3%82%B3%E3%83%BC%E3%83%89%E3%81%AE%E6%8C%87%E5%AE%9A%E8%A1%8C%E3%81%AE%E5%BC%B7%E8%AA%BF)\n  - [コミットからissueを閉じる](#%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88%E3%81%8B%E3%82%89issue%E3%82%92%E9%96%89%E3%81%98%E3%82%8B)\n  - [issueの相互リンク](#issue%E3%81%AE%E7%9B%B8%E4%BA%92%E3%83%AA%E3%83%B3%E3%82%AF)\n  - [コメントのロック](#%E3%82%B3%E3%83%A1%E3%83%B3%E3%83%88%E3%81%AE%E3%83%AD%E3%83%83%E3%82%AF)\n  - [pull requestでのCI結果の表示](#pull-request%E3%81%A7%E3%81%AEci%E7%B5%90%E6%9E%9C%E3%81%AE%E8%A1%A8%E7%A4%BA)\n  - [絞り込み検索](#%E7%B5%9E%E3%82%8A%E8%BE%BC%E3%81%BF%E6%A4%9C%E7%B4%A2)\n  - [Markdownファイルでの構文強調](#markdown%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%A7%E3%81%AE%E6%A7%8B%E6%96%87%E5%BC%B7%E8%AA%BF)\n  - [Emoji](#emoji)\n  - [画像及びアニメーションGIF](#%E7%94%BB%E5%83%8F%E5%8F%8A%E3%81%B3%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3gif)\n    - [GitHub Wikiへの画像の添付](#github-wiki%E3%81%B8%E3%81%AE%E7%94%BB%E5%83%8F%E3%81%AE%E6%B7%BB%E4%BB%98)\n  - [素早く引用](#%E7%B4%A0%E6%97%A9%E3%81%8F%E5%BC%95%E7%94%A8)\n  - [コメントへのクリップボードの画像の追加](#%E3%82%B3%E3%83%A1%E3%83%B3%E3%83%88%E3%81%B8%E3%81%AE%E3%82%AF%E3%83%AA%E3%83%83%E3%83%97%E3%83%9C%E3%83%BC%E3%83%89%E3%81%AE%E7%94%BB%E5%83%8F%E3%81%AE%E8%BF%BD%E5%8A%A0)\n  - [設定済みライセンスの追加](#%E8%A8%AD%E5%AE%9A%E6%B8%88%E3%81%BF%E3%83%A9%E3%82%A4%E3%82%BB%E3%83%B3%E3%82%B9%E3%81%AE%E8%BF%BD%E5%8A%A0)\n  - [タスクリスト](#%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%AA%E3%82%B9%E3%83%88)\n    - [Markdownファイルでのタスクリスト](#markdown%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%A7%E3%81%AE%E3%82%BF%E3%82%B9%E3%82%AF%E3%83%AA%E3%82%B9%E3%83%88)\n  - [相対リンク](#%E7%9B%B8%E5%AF%BE%E3%83%AA%E3%83%B3%E3%82%AF)\n  - [GitHub Pagesでのメタデータとプラグインのサポート](#github-pages%E3%81%A7%E3%81%AE%E3%83%A1%E3%82%BF%E3%83%87%E3%83%BC%E3%82%BF%E3%81%A8%E3%83%97%E3%83%A9%E3%82%B0%E3%82%A4%E3%83%B3%E3%81%AE%E3%82%B5%E3%83%9D%E3%83%BC%E3%83%88)\n  - [文書内のYAMLメタデータ](#%E6%96%87%E6%9B%B8%E5%86%85%E3%81%AEyaml%E3%83%A1%E3%82%BF%E3%83%87%E3%83%BC%E3%82%BF)\n  - [表形式のデータ表示](#%E8%A1%A8%E5%BD%A2%E5%BC%8F%E3%81%AE%E3%83%87%E3%83%BC%E3%82%BF%E8%A1%A8%E7%A4%BA)\n  - [PDF表示](#pdf%E8%A1%A8%E7%A4%BA)\n  - [pull requestの取り消し](#pull-request%E3%81%AE%E5%8F%96%E3%82%8A%E6%B6%88%E3%81%97)\n  - [差分の表示](#%E5%B7%AE%E5%88%86%E3%81%AE%E8%A1%A8%E7%A4%BA)\n    - [レンダリング済みの差分表示](#%E3%83%AC%E3%83%B3%E3%83%80%E3%83%AA%E3%83%B3%E3%82%B0%E6%B8%88%E3%81%BF%E3%81%AE%E5%B7%AE%E5%88%86%E8%A1%A8%E7%A4%BA)\n    - [マップ差分の可視化](#%E3%83%9E%E3%83%83%E3%83%97%E5%B7%AE%E5%88%86%E3%81%AE%E5%8F%AF%E8%A6%96%E5%8C%96)\n    - [差分表示の前後を表示](#%E5%B7%AE%E5%88%86%E8%A1%A8%E7%A4%BA%E3%81%AE%E5%89%8D%E5%BE%8C%E3%82%92%E8%A1%A8%E7%A4%BA)\n    - [pull requestの内容をDIFFまたはPATCH形式で取得](#pull-request%E3%81%AE%E5%86%85%E5%AE%B9%E3%82%92diff%E3%81%BE%E3%81%9F%E3%81%AFpatch%E5%BD%A2%E5%BC%8F%E3%81%A7%E5%8F%96%E5%BE%97)\n    - [画像の表示とDIFF](#%E7%94%BB%E5%83%8F%E3%81%AE%E8%A1%A8%E7%A4%BA%E3%81%A8diff)\n  - [Hub](#hub)\n  - [開発参加のガイドライン](#%E9%96%8B%E7%99%BA%E5%8F%82%E5%8A%A0%E3%81%AE%E3%82%AC%E3%82%A4%E3%83%89%E3%83%A9%E3%82%A4%E3%83%B3)\n  - [Octicons](#octicons)\n  - [GitHub情報](#github%E6%83%85%E5%A0%B1)\n    - [GitHub Talks](#github-talks)\n- [Git](#git)\n  - [すべての削除済みファイルをワーキング・ツリーから削除する](#%E3%81%99%E3%81%B9%E3%81%A6%E3%81%AE%E5%89%8A%E9%99%A4%E6%B8%88%E3%81%BF%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E3%83%AF%E3%83%BC%E3%82%AD%E3%83%B3%E3%82%B0%E3%83%84%E3%83%AA%E3%83%BC%E3%81%8B%E3%82%89%E5%89%8A%E9%99%A4%E3%81%99%E3%82%8B)\n  - [直前のブランチ](#%E7%9B%B4%E5%89%8D%E3%81%AE%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81)\n  - [空白の削除](#%E7%A9%BA%E7%99%BD%E3%81%AE%E5%89%8A%E9%99%A4)\n  - [SSH公開鍵](#ssh%E5%85%AC%E9%96%8B%E9%8D%B5)\n  - [pull requestのチェックアウト](#pull-request%E3%81%AE%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%82%A2%E3%82%A6%E3%83%88)\n  - [空のコミット](#%E7%A9%BA%E3%81%AE%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88)\n  - [Gitステータスのスタイリング](#git%E3%82%B9%E3%83%86%E3%83%BC%E3%82%BF%E3%82%B9%E3%81%AE%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AA%E3%83%B3%E3%82%B0)\n  - [Gitログのスタイリング](#git%E3%83%AD%E3%82%B0%E3%81%AE%E3%82%B9%E3%82%BF%E3%82%A4%E3%83%AA%E3%83%B3%E3%82%B0)\n  - [コミットログの検索](#%E3%82%B3%E3%83%9F%E3%83%83%E3%83%88%E3%83%AD%E3%82%B0%E3%81%AE%E6%A4%9C%E7%B4%A2)\n  - [Git Grep](#git-grep)\n  - [マージ済みブランチ](#%E3%83%9E%E3%83%BC%E3%82%B8%E6%B8%88%E3%81%BF%E3%83%96%E3%83%A9%E3%83%B3%E3%83%81)\n  - [FixupとAutosquash](#fixup%E3%81%A8autosquash)\n  - [ローカル・リポジトリを参照するウェブサーバー](#%E3%83%AD%E3%83%BC%E3%82%AB%E3%83%AB%E3%83%AA%E3%83%9D%E3%82%B8%E3%83%88%E3%83%AA%E3%82%92%E5%8F%82%E7%85%A7%E3%81%99%E3%82%8B%E3%82%A6%E3%82%A7%E3%83%96%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC)\n  - [Gitの設定](#git%E3%81%AE%E8%A8%AD%E5%AE%9A)\n    - [エイリアス](#%E3%82%A8%E3%82%A4%E3%83%AA%E3%82%A2%E3%82%B9)\n    - [コマンドの自動修正](#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%AE%E8%87%AA%E5%8B%95%E4%BF%AE%E6%AD%A3)\n    - [色設定](#%E8%89%B2%E8%A8%AD%E5%AE%9A)\n  - [Git情報](#git%E6%83%85%E5%A0%B1)\n    - [Git Books](#git-books)\n- [訳注](#%E8%A8%B3%E6%B3%A8)\n\n## GitHub\n### 空白の無視\nGitHub上で差分ページを表示している時、そのURLに`?w=1`を加えると、空白の変化によるできた差分は表示されなくなり、コード上の変化だけを参照することができる。\n\n![Diff without whitespace](https://camo.githubusercontent.com/797184940defadec00393e6559b835358a863eeb/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f776869746573706163652e706e67)\n\n[*GitHubの秘密についてもっと詳しく*](https://github.com/blog/967-github-secrets)\n\n### タブ幅の調節\n差分やファイルを表示している時、URLに`?ts=4`を追加するとタブを空白4つの幅で表示する。デフォルトは8つだ。`ts`に指定した数で表示されるということだ。これはGistやrawファイルを表示している時には適用されないが、[Chrome](https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn)をインストールすることにより、対応することができる。\n\n例えばGoのソースファイルを表示している時、`?ts=4`を追加する前はこのように表示されるが:\n\n![Before, tab space example](http://i.imgur.com/GIT1Fr0.png)\n\n`?ts=4`を追加するとこのように表示される:\n\n![After, tab space example](http://i.imgur.com/70FL4H9.png)\n\n### 特定のユーザーによるコミット履歴\n特定のユーザーによるあるリポジトリへのコミット履歴のみを参照したい場合は、`?author={user}`をURLの末尾に付ける。\n\n```\nhttps://github.com/rails/rails/commits/master?author=dhh\n```\n![DHH commit history](http://i.imgur.com/S7AE29b.png)\n\n[*コミット・ビューの違いについてもっと詳しく*](https://help.github.com/articles/differences-between-commit-views)\n\n### リポジトリのクローン\nリポジトリをクローンする時、URLの末尾の`.git`は無くても構わない。\n\n```bash\n$ git clone https://github.com/tiimgreen/github-cheat-sheet\n```\n\n[*Gitの`clone`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-clone)\n\n### ブランチ\n#### 全ブランチを別のブランチと比較\nコミット一覧ボタンの隣から[ブランチ一覧](https://github.com/tiimgreen/github-cheat-sheet/branches)ページに行くと:\n\n```\nhttps://github.com/{user}/{repo}/branches\n```\n\nメイン・ブランチにマージされていないブランチの一覧が表示される。\n\nこのページからボタンをクリックしてブランチ比較ページへ移動したりブランチを削除することができる。\n\n![Compare branches not merged into master in rails/rails repo - https://github.com/rails/rails/branches](http://i.imgur.com/0FEe30z.png)\n\n#### ブランチ同士の比較\nGitHubのブランチ比較は以下のようなURLで提供されている:\n\n```\nhttps://github.com/{user}/{repo}/compare/{range}\n```\n\n`{range}`を`master...4-1-stable`に変更する。\n\n例えば:\n\n```\nhttps://github.com/rails/rails/compare/master...4-1-stable\n```\n![Rails branch compare example](http://i.imgur.com/tIRCOsK.png)\n\n`{range}`には以下のように変更することもできる:\n\n```\nhttps://github.com/rails/rails/compare/master@{1.day.ago}...master\nhttps://github.com/rails/rails/compare/master@{2014-10-04}...master\n```\n\n*日付の形式は`YYYY-MM-DD`だ。*\n\n![Another compare example](http://i.imgur.com/5dtzESz.png)\n\n`diff`や`patch`のビューでもブランチを利用して比較することができる:\n\n```\nhttps://github.com/rails/rails/compare/master...4-1-stable.diff\nhttps://github.com/rails/rails/compare/master...4-1-stable.patch\n```\n\n[*時間を指定してのブランチ比較についてもっと詳しく*](https://help.github.com/articles/comparing-commits-across-time)\n\n#### フォークされたリポジトリ間でのブランチ比較\nGitHubでフォークされたリポジトリ同士でブランチを比較する場合、以下のようなURLを変更する:\n\n```\nhttps://github.com/user/repo/compare/{foreign-user}:{branch}...{own-branch}\n```\n\n例:\n\n```\nhttps://github.com/rails/rails/compare/byroot:master...master\n```\n\n![Forked branch compare](http://i.imgur.com/Q1W6qcB.png)\n\n### Gists\n[Gists](https://gist.github.com/)は少量のコード群を管理する最適な手段だ。ちゃんとしたリポジトリをいちいち作成する必要はない。\n\n![Gist](http://i.imgur.com/VkKI1LC.png?1)\n\nGistのURLの最後に`.pibb`を付ける([例](https://gist.github.com/hail2u/9477708.pibb))と*HTMLのみ*のバージョンが表示されるので、そのソースは他のウェブサイトに貼り付けるにはもってこいだろう。\n\n簡単なものとはいえ、Gitリポジトリとして機能するため、以下のようにすれば普通のGitリポジトリと同じようにクローンすることができる:\n\n```bash\n$ git clone https://gist.github.com/tiimgreen/10545817\n```\n\n![Gists](http://i.imgur.com/BcFzabp.png)\n\nThis means you also can modify and push updates to Gists:\n\n```bash\n$ git commit\n$ git push\nUsername for 'https://gist.github.com':\nPassword for 'https://tiimgreen@gist.github.com':\n```\n\nしかしながら、Gistではディレクトリーがサポートされていない。全てのファイルはリポジトリーのルートに置かれている必要がある。\n\n[*Gistの作成についてもっと詳しく*](https://help.github.com/articles/creating-gists)\n\n### Git.io\n[Git.io](http://git.io)はGitHubの提供するGitHub専用のシンプルな短縮URLサービスだ。\n\n![Git.io](http://i.imgur.com/6JUfbcG.png?1)\n\ncURLを使って利用することができる:\n\n```bash\n$ curl -i http://git.io -F \"url=https://github.com/...\"\nHTTP/1.1 201 Created\nLocation: http://git.io/abc123\n\n$ curl -i http://git.io/abc123\nHTTP/1.1 302 Found\nLocation: https://github.com/...\n```\n\n[*Git.ioについてもっと詳しく*](https://github.com/blog/985-git-io-github-url-shortener)\n\n### キーボード・ショートカット\nリポジトリをブラウザーで開いている時は、ショートカットを利用して様々な機能ヘ簡単にアクセスできるようになっている。\n\n - `t`を押すとファイルの検索インターフェイスが起動する。\n - `w`を押すとブランチ選択インターフェイスが起動する。\n - `s`を押すと現在閲覧しているリポジトリーから検索するフォームにフォーカスが当たる。ここでBackspaceを押し「This repository」という文字列を消すことでGitHub全体からの検索へと切り替えることができる\n - issue画面で`l`を押すとラベルの編集インターフェイスが開かれる。\n - __ファイルを参照している時__（例: `https://github.com/tiimgreen/github-cheat-sheet/blob/master/README.md`)に`y`を押すと、参照している時の状態で固定されるURLに変更される。つまりそのファイルのコードが後に変化したとしても、そのURLでは今とまったく同じ状態で表示されるということだ。\n\n`?`を押すとそのページで使える全ショートカットが表示されるだろう。\n\n![Keyboard shortcuts](http://i.imgur.com/y5ZfNEm.png)\n\n[*検索機能についてもっと詳しく*](https://help.github.com/articles/search-syntax/)\n\n### コードの指定行の強調\nコードのURLの末尾に`#L52`と付けるか行番号をクリックすると、その行が強調表示される。\n\nこれは範囲指定も可能だ（例: `#L53-L60`）。こういった範囲を選択するには`shift`を押しながら二つの行をクリックしても良い:\n\n```\nhttps://github.com/rails/rails/blob/master/activemodel/lib/active_model.rb#L53-L60\n```\n\n![Line Highlighting](http://i.imgur.com/8AhjrCz.png)\n\n### コミットからissueを閉じる\nあるコミットでissueを解決した場合、コミットメッセージで`fix/fixes/fixed`や`close/closes/closed`、`resolve/resolves/resolved`に続けてissue番号を指定すると、そのコミットがmasterブランチにpushされると同時に指定issueが閉じられるだろう。\n\n```bash\n$ git commit -m \"Fix screwup, fixes #12\"\n```\n\nこうするとissue#12が閉じられ、閉じたissueにはそのコミットへの参照が自動的に追加される。\n\n![Closing Repo](http://i.imgur.com/Uh1gZdx.png)\n\n[*コミット・メッセージからissueを閉じる方法についてもっと詳しく*](https://help.github.com/articles/closing-issues-via-commit-messages)\n\n### issueの相互リンク\n同じリポジトリの違うissueへリンクを張り参照させたい場合、`#`に続けてissue番号を指定する。そうすると自動的にリンクが作成されるだろう。\n\n別のリポジトリのissueの場合は`{user}/{repo}#ISSUE_NUMBER`とすれば良い（例: `tiimgreen/toc#12`）。\n\n![Cross-Link Issues](https://camo.githubusercontent.com/447e39ab8d96b553cadc8d31799100190df230a8/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f626c6f672f323031312f736563726574732f7265666572656e6365732e706e67)\n\n### コメントのロック\nリポジトリのオーナーや共同開発者ならば、pull requestやissueへのコメントをロックできるようになった。\n\n![Lock conversation](https://cloud.githubusercontent.com/assets/2723/3221693/bf54dd44-f00d-11e3-8eb6-bb51e825bc2c.png)\n\nつまりそのプロジェクトの共同開発者ではないユーザーはコメントをすることができないということだ。\n\n![Comments locked](https://cloud.githubusercontent.com/assets/2723/3221775/d6e513b0-f00e-11e3-9721-2131cb37c906.png)\n\n[*コメントのロックについてもっと詳しく*](https://github.com/blog/1847-locking-conversations)\n\n### pull requestでのCI結果の表示\n適切に設定を行えばpull requestを受け取るたびに、通常のコミットと同じように[Travis CI](https://travis-ci.org/)がそのpull requestをビルドするだろう。どう設定するかは[Travis CI: Getting started](http://docs.travis-ci.com/user/getting-started/)を読むと良い。\n\n[![Travis CI status](https://cloud.githubusercontent.com/assets/1687642/2700187/3a88838c-c410-11e3-9a46-e65e2a0458cd.png)](https://github.com/octokit/octokit.rb/pull/452)\n\n[*コミット・ステータスAPIについてもっと詳しく*](https://github.com/blog/1227-commit-status-api)\n\n### 絞り込み検索\nissueとpull requestの検索インターフェイスでは、絞り込みをかけることが可能だ。\n\n例えば[Railsのリポジトリー](https://github.com/rails/rails/issues)では、以下の様な絞り込み検索により\"activerecord\"というラベルがついたissueのみを表示することができる:\n\n`is:issue label:activerecord`\n\n逆に\"activerecord\"というラベルが*ついていない*issueのみを表示することもできる:\n\n`is:issue -label:activerecord`\n\nそして、この絞り込み検索はpull requestに対しても行うことができる:\n\n`is:pr -label:activerecord`\n\nGitHubでは開かれているissueやpull requestのみを表示するタブ、または既に閉じられたそれらのみを表示するタブが用意されているが、絞り込み検索によってマージ済みのpull requestのみを表示することもできる。以下のようなフィルターを使えば良いだろう:\n\n`is:merged`\n\n[*issueの検索についてもっと詳しく*](https://help.github.com/articles/searching-issues)\n\nそしてGitHubはStatus APIの結果を使ってフィルターすることもできるようになった。\n\nStatus APIでsuccessが設定されたpull requestのみ:\n\n`status:success`\n\n[*Status APIを使った絞り込み検索についてもっと詳しく*](https://github.com/blog/2014-filter-pull-requests-by-status)\n\n### Markdownファイルでの構文強調\n例えばMarkdownファイルでRubyのコードを構文強調したいならば以下のようにする:\n\n    ```ruby\n    require 'tabbit'\n    table = Tabbit.new('Name', 'Email')\n    table.add_row('Tim Green', 'tiimgreen@gmail.com')\n    puts table.to_s\n    ```\n\nこうすると以下のように表示されることになる:\n\n```ruby\nrequire 'tabbit'\ntable = Tabbit.new('Name', 'Email')\ntable.add_row('Tim Green', 'tiimgreen@gmail.com')\nputs table.to_s\n```\n\nGitHubでは[Linguist](https://github.com/github/linguist)を使って言語を判別し構文強調を行っている。構文強調がサポートされている言語の一覧は[言語定義YAMLファイル](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)を参照すればわかるだろう。\n\n[*GitHub Flavored Markdownについてもっと詳しく*](https://help.github.com/articles/github-flavored-markdown)\n\n### Emoji\nEmojiはpull requestやissue、コミット・メッセージ、リポジトリーの概要などで`:name_of_emoji:`と書くと利用できる:\n\nGitHubでサポートされているEmojiの完全なリストは[Emoji cheat sheet for Campfire and GitHub](http://www.emoji-cheat-sheet.com/)か[All-Github-Emoji-Icons](https://github.com/scotch-io/All-Github-Emoji-Icons)で確認できる。\n素敵なemojiの検索は[emoji.muan.co](http://emoji.muan.co/)。\n\nGitHubで使われているEmojiのトップ5は以下の通りだ:\n\n1. `:shipit:`\n2. `:sparkles:`\n3. `:-1:`\n4. `:+1:`\n5. `:clap:`\n\n### 画像及びアニメーションGIF\n画像やアニメーションGIFはコミットのコメントやREADMEなどで利用できる:\n\n```\n![Alt Text](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)\n```\n\nリポジトリにある画像も直接参照することが出来る:\n\n```\n![Alt Text](https://github.com/{user}/{repo}/raw/master/path/to/image.gif)\n```\n\n![Peter don't care](http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif)\n\nあらゆる画像はGitHubでキャッシュされるので、画像のホスティング先が落ちていたとしても変わらず表示されるだろう。\n\n#### GitHub Wikiへの画像の添付\nGitHub Wikiで画像を追加する方法がいくつかある。通常のMarkdown記法（前節を参照）はもちろん使える。しかしそれだけではなく、画像の幅と高さを指定する記法も使うことができる:\n\n```markdown\n[[ http://www.sheawong.com/wp-content/uploads/2013/08/keephatin.gif | height = 100px ]]\n```\n\nこうすると以下のようになる:\n\n![Just a screenshot](http://i.imgur.com/J5bMf7S.png)\n\n### 素早く引用\nissueのスレッドで他の人のコメントを引用してコメントしたい場合、引用したい文章を選択した状態で`r`を押すと、ブロック引用の記法を使ってテキストエリアにコピーされる。\n\n![Quick Quote](http://i.imgur.com/TzpMIOA.png)\n\n[*素早く引用する方法についてもっと詳しく*](https://github.com/blog/1399-quick-quotes)\n\n### コメントへのクリップボードの画像の追加\n\n_(Chrome系のブラウザーのみで動作)_\n\nスクリーンショットをクリップボードに保存(mac: `cmd-ctrl-shift-4`)した後、その画像はコメント投稿フォームで貼り付け(`cmd-v`または`ctrl-v`)ることができ、自動的にGitHubへアップロードされます。\n\n![Pasting Clipboard Image to Comments](https://cloud.githubusercontent.com/assets/39191/5794265/39c9b65a-9f1b-11e4-9bc7-04e41f59ea5f.png)\n\n[*コメントへのクリップボードの画像の追加についてもっと詳しく*](https://help.github.com/articles/issue-attachments)\n\n### 設定済みライセンスの追加\nGitHub上でリポジトリを作成する時、あらかじめ設定されているライセンスを追加することもできる:\n\n![Licese](http://i.imgur.com/Chqj4Fg.png)\n\n既に存在するリポジトリであってもウェブ上のインターフェイスからファイルを作成することで追加できる。`LICENSE`というファイル名にした場合、ライセンスを選択するオプションが表示されるのだ:\n\n![License](http://i.imgur.com/fTjQict.png)\n\n`.gitignore`も同じように作成時に追加することも、後で追加することもできる。\n\n[*オープンソース・ライセンスについてもっと詳しく*](https://help.github.com/articles/open-source-licensing)\n\n### タスクリスト\nissueやpull requestでは以下のように（空白に注意）書くとチェックボックスを作成することができる:\n\n```\n- [ ] Be awesome\n- [ ] Prepare dinner\n  - [ ] Research recipe\n  - [ ] Buy ingredients\n  - [ ] Cook recipe\n- [ ] Sleep\n```\n\n![Task List](http://i.imgur.com/jJBXhsY.png)\n\nこれらチェックボックスにチェックが入れられると、同時にMarkdownソースも更新される:\n\n```\n- [x] Be awesome\n- [ ] Prepare dinner\n  - [x] Research recipe\n  - [x] Buy ingredients\n  - [ ] Cook recipe\n- [ ] Sleep\n```\n\n[*タスク・リストについてもっと詳しく*](https://help.github.com/articles/writing-on-github#task-lists)\n\n#### Markdownファイルでのタスクリスト\n通常のMarkdownファイルでも**読み取り専用**のチェックリストを以下のような記法で追加することができる:\n\n```\n- [ ] Mercury\n- [x] Venus\n- [x] Earth\n- [x] Mars\n- [ ] Jupiter\n```\n\n- [ ] Mercury\n- [x] Venus\n- [x] Earth\n- [x] Mars\n- [ ] Jupiter\n\n[*Markdownファイルでのタスクリストについてもっと詳しく*](https://github.com/blog/1825-task-lists-in-all-markdown-documents)\n\n### 相対リンク\nMarkdownファイルでリポジトリ内のコンテンツへ張る場合、相対リンクを利用することが推奨されている。\n\n```markdown\n[Link to a header](#awesome-section)\n[Link to a file](docs/readme)\n```\n\n絶対リンクはURLの変更（例: リポジトリのリネーム、ユーザー名の変更、プロジェクトのフォーク）により更新される。相対リンクを利用すれば、そのままうまく機能するはずだ。\n\n[*相対リンクについてもっと詳しく*](https://help.github.com/articles/relative-links-in-readmes)\n\n### GitHub Pagesでのメタデータとプラグインのサポート\nJekyllのページや投稿ではリポジトリの情報が`site.github`という名前空間に格納されており、例えば`{{ site.github.project_title }}`などと書けば表示することができる。\n\nまた、Jemojiとjekyll-mentionsというプラグインがインストールされているので、[Emoji](#emoji)や[@mentions](https://github.com/blog/821)はJekyllの投稿やページでGitHub.com上と同じように動作する。\n\n[*GitHub Pageでのメタデータとプラグインのサポートについてもっと詳しく*](https://github.com/blog/1797-repository-metadata-and-plugin-support-for-github-pages)\n\n### 文書内のYAMLメタデータ\n[Jekyll](http://jekyllrb.com/)を[GitHub Pages](http://pages.github.com/)で利用している場合など、多くのブログではYAML形式のメタデータをその記事の先頭に書く必要がある。GitHubではこういったメタデータを読みやすいように表として表示してくれる:\n\n![YAML metadata](https://camo.githubusercontent.com/47245aa16728e242f74a9a324ce0d24c0b916075/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f36343035302f313232383236372f65303439643063362d323761302d313165332d396464382d6131636432323539393334342e706e67)\n\n[*文書内のYAMLメタデータの表示についてもっと詳しく*](https://github.com/blog/1647-viewing-yaml-metadata-in-your-documents)\n\n### 表形式のデータ表示\nGitHubでは`.csv`（カンマ区切り）と`.tsv`（タブ区切り）の形式で書かれた表を整形して表示する機能をサポートしている。\n\n![Tabular data](https://camo.githubusercontent.com/1b6dd0157ffb45d9939abf14233a0cb13b3b4dfe/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f3238323735392f3937363436322f33323038336463652d303638642d313165332d393262322d3566323863313061353035392e706e67)\n\n[*表形式のデータ表示についてもっと詳しく*](https://github.com/blog/1601-see-your-csvs)\n\n### PDF表示\nGitHubではPDFの表示をサポートしている:\n\n![PDF](https://cloud.githubusercontent.com/assets/1000669/7492902/f8493160-f42e-11e4-8cea-1cb4f02757e7.png)\n\n[*PDF表示についてもっと詳しく*](https://github.com/blog/1974-pdf-viewing)\n\n### pull requestの取り消し\npull requestをマージした後、意味がなかったことがわかったり、そのpull requestをマージしたのは間違いだったことがわかることもあるだろう。\n\nその取り消しは、pull requestのページに表示されているマージ・コミットの右端にある**Revert**ボタンをクリックすることにより、そのpull requestで行われた変更を取り消すpull requestを作成することによって行うことができる。\n\n![Revert button](https://camo.githubusercontent.com/0d3350caf2bb1cba53123ffeafc00ca702b1b164/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f68656c702f70756c6c5f72657175657374732f7265766572742d70756c6c2d726571756573742d6c696e6b2e706e67)\n\n[*pull requestの取り消しについてもっと詳しく*](https://github.com/blog/1857-introducing-the-revert-button)\n\n### 差分の表示\n#### レンダリング済みの差分表示\nコミットやpull requestにGitHubでレンダリングされて表示されるもの（例: Markdown）が含まれる場合、その*ソース*と*レンダリング済み*の両方の差分を見ることができる。\n\n![Source / Rendered view](https://github-images.s3.amazonaws.com/help/repository/rendered_prose_diff.png)\n\nレンダリングされた状態での差分を表示したい場合は「Rendered」ボタンをクリックする。レンダリング済みの差分表示では文章の追加や削除、編集がよりわかりやすい:\n\n![Rendered Prose Diffs](https://f.cloud.github.com/assets/17715/2003056/3997edb4-862b-11e3-90be-5e9586edecd7.png)\n\n[*レンダリング済みの差分表示についてもっと詳しく*](https://github.com/blog/1784-rendered-prose-diffs)\n\n#### マップ差分の可視化\nコミットやpull requestにジオデータの変更が含まれている場合はいつも、GitHubではそのジオデータの変化を可視化してくれるだろう。\n\n[![Diffable Maps](https://f.cloud.github.com/assets/282759/2090660/63f2e45a-8e97-11e3-9d8b-d4c8078b004e.gif)](https://github.com/benbalter/congressional-districts/commit/2233c76ca5bb059582d796f053775d8859198ec5)\n\n[*マップ差分の可視化についてもっと詳しく*](https://github.com/blog/1772-diffable-more-customizable-maps)\n\n#### 差分表示の前後を表示\n差分表示の行番号付近にある*展開*ボタンを使うと、その前後の行をクリックして表示させることができる。*展開*ボタンを押し続けることによってファイル全体を表示することもできるし、またこの機能はあらゆるGitHubの差分表示ビューに用意されている。\n\n![Expanding Context in Diffs](https://f.cloud.github.com/assets/22635/1610539/863c1f64-5584-11e3-82bf-151b406a272f.gif)\n\n[*差分表示の前後を表示についてもっと詳しく*](https://github.com/blog/1705-expanding-context-in-diffs)\n\n#### pull requestの内容をDIFFまたはPATCH形式で取得\npull requestによる差分はそのURLの末尾に`.diff`または`.patch`を追加すると、それぞれの形式で取得することができる。例えば:\n\n```\nhttps://github.com/tiimgreen/github-cheat-sheet/pull/15\nhttps://github.com/tiimgreen/github-cheat-sheet/pull/15.diff\nhttps://github.com/tiimgreen/github-cheat-sheet/pull/15.patch\n```\n\n拡張子`.diff`を追加した場合、このようなプレーンテキストで表示されるだろう:\n\n```\ndiff --git a/README.md b/README.md\nindex 88fcf69..8614873 100644\n--- a/README.md\n+++ b/README.md\n@@ -28,6 +28,7 @@ All the hidden and not hidden features of Git and GitHub. This cheat sheet was i\n - [Merged Branches](#merged-branches)\n - [Quick Licensing](#quick-licensing)\n - [TODO Lists](#todo-lists)\n+- [Relative Links](#relative-links)\n - [.gitconfig Recommendations](#gitconfig-recommendations)\n     - [Aliases](#aliases)\n     - [Auto-correct](#auto-correct)\n@@ -381,6 +382,19 @@ When they are clicked, they will be updated in the pure Markdown:\n - [ ] Sleep\n\n(...)\n```\n\n#### 画像の表示とDIFF\nGitHubは、PNGやJPG、GIF、PSDといった多くの一般的な画像形式の表示をサポートしている。それに加え、様々な方法でこれら画像形式のバージョンごとの差分を比較することもできる。\n\n[![Diffable PSD](https://cloud.githubusercontent.com/assets/2546/3165594/55f2798a-eb56-11e3-92e7-b79ad791a697.gif)](https://github.com/blog/1845-psd-viewing-diffing)\n\n[*画像の表示とDIFFについてもっと詳しく*](https://help.github.com/articles/rendering-and-diffing-images)\n\n### Hub\n[Hub](https://github.com/github/hub)はGitのラッパーとして機能するコマンドライン・ツールで、これを利用するとGitHubをコマンドラインからとても簡単に扱えるようになる。\n\n例えば以下のようにしてリポジトリのクローンが行える:\n\n```bash\n$ hub clone tiimgreen/toc\n```\n\nこれが以下のコマンドの代わりというわけだ:\n\n```bash\n$ git clone https://github.com/tiimgreen/toc.git\n```\n\n[*Hubが提供する便利な機能についてもっと詳しく*](https://github.com/github/hub#commands)\n\n### 開発参加のガイドライン\nリポジトリのルートに`CONTRIBUTING`という名前のファイルを置くと、issueやpull requestを作成しようとした時にそれへのリンクが表示されるようになる。\n\n![Contributing Guidelines](https://camo.githubusercontent.com/71995d6b0e620a9ef1ded00a04498241c69dd1bf/68747470733a2f2f6769746875622d696d616765732e73332e616d617a6f6e6177732e636f6d2f736b697463682f6973737565732d32303132303931332d3136323533392e6a7067)\n\n[*開発参加のガイドラインについてもっと詳しく*](https://github.com/blog/1184-contributing-guidelines)\n\n### Octicons\nGitHubで使われているアイコン（Octicons）はオープンソース化された。\n\n![Octicons](https://og.github.com/octicons/octicons@1200x630.png)\n\n[*GitHubのOcticonsについてもっと詳しく*](https://octicons.github.com)\n\n### GitHub情報\n| Title | Link |\n| ----- | ---- |\n| GitHub Explore | https://github.com/explore |\n| GitHub Blog | https://github.com/blog |\n| GitHub Help | https://help.github.com/ |\n| GitHub Training | http://training.github.com/ |\n| GitHub Developer | https://developer.github.com/ |\n\n#### GitHub Talks\n| Title | Link |\n| ----- | ---- |\n| How GitHub Uses GitHub to Build GitHub | https://www.youtube.com/watch?v=qyz3jkOBbQY |\n| Introduction to Git with Scott Chacon of GitHub | https://www.youtube.com/watch?v=ZDR433b0HJY |\n| How GitHub No Longer Works | https://www.youtube.com/watch?v=gXD1ITW7iZI |\n| Git and GitHub Secrets | https://www.youtube.com/watch?v=Foz9yvMkvlA |\n| More Git and GitHub Secrets | https://www.youtube.com/watch?v=p50xsL-iVgU |\n\n## Git\n### すべての削除済みファイルをワーキング・ツリーから削除する\n例えば`/bin/rm`を使って大量のファイルを削除した場合、以下のコマンドを使えばワーキング・ツリー、そしてインデックスからも削除することができ、ファイルごとにそれぞれGitコマンドを実行する必要がなくなる:\n\n```bash\n$ git rm $(git ls-files -d)\n```\n\n例えば以下のように実行される:\n\n```bash\n$ git status\nOn branch master\nChanges not staged for commit:\n\tdeleted:    a\n\tdeleted:    c\n\n$ git rm $(git ls-files -d)\nrm 'a'\nrm 'c'\n\n$ git status\nOn branch master\nChanges to be committed:\n\tdeleted:    a\n\tdeleted:    c\n```\n\n### 直前のブランチ\nGitで直前のブランチへ移動するには:\n\n```bash\n$ git checkout -\n# Switched to branch 'master'\n\n$ git checkout -\n# Switched to branch 'next'\n\n$ git checkout -\n# Switched to branch 'master'\n```\n\n[*Gitのブランチ操作についてもっと詳しく*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)\n\n### 空白の削除\nGitの`stripspace`コマンドは以下の作業を行う:\n\n- 行末の空白文字の削除\n- 空白行の取りまとめ\n- ファイル末尾への改行の追加\n\nこのコマンドを呼ぶ時はファイルを渡さねばならない。例:\n\n```bash\n$ git stripspace \u003c README.md\n```\n\n[*Gitの`stripspace`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-stripspace)\n\n### SSH公開鍵\n以下のURLにアクセスすることで、SSH公開鍵の一覧をテキスト形式で取得することができる:\n\n```\nhttps://github.com/{user}.keys\n```\n\n例: [https://github.com/tiimgreen.keys](https://github.com/tiimgreen.keys)\n\n[*SSH公開鍵についてもっと詳しく*](https://changelog.com/github-exposes-public-ssh-keys-for-its-users/)\n\n### pull requestのチェックアウト\npull requestはGitHubのリポジトリでは特別なブランチであり、様々な方法でローカルに取り込むことができる:\n\n特定のpull requestを取り込み、一時的に`FETCH_HEAD`として保存すると、素早く差分を確認してマージすることが可能だ:\n\n```bash\n$ git fetch origin refs/pull/[PR-Number]/head\n```\n\n参照仕様を使うとすべてのpull requestをローカル・ブランチとして取り込むことができる:\n\n```bash\n$ git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'\n```\n\nリポジトリの`.git/config`に以下の行を追加すれば自動的にpull requestを落とすようにもできるだろう:\n\n```\n[remote \"origin\"]\n    fetch = +refs/heads/*:refs/remotes/origin/*\n    url = git@github.com:tiimgreen/github-cheat-sheet.git\n```\n\n```\n[remote \"origin\"]\n    fetch = +refs/heads/*:refs/remotes/origin/*\n    url = git@github.com:tiimgreen/github-cheat-sheet.git\n    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*\n```\n\nフォークされてから送られてきたpull requestに対しては、そのpull requestを参照するリモート・ブランチから直接ローカル・ブランチとしてチェックアウトすると便利だろう:\n\n```bash\n$ git checkout pr/42 pr-42\n```\n\nもしくは様々なリポジトリで作業をするのなら、代わりにグローバルのGit設定で行うことにより、pull requestの取得をグローバルに設定すると良いだろう。\n\n```bash\ngit config --global --add remote.origin.fetch \"+refs/pull/*/head:refs/remotes/origin/pr/*\"\n```\n\nこうすると以下の様な短いコマンドを利用することが可能になる:\n\n```bash\ngit fetch origin\n```\n\n```bash\ngit checkout pr/42\n```\n\n[*pull requestのチェックアウトについてもっと詳しく*](https://help.github.com/articles/checking-out-pull-requests-locally)\n\n### 空のコミット\n`--allow-empty`オプションを付けると、コードの変化がなくてもコミットを作成することができる:\n\n```bash\n$ git commit -m \"Big-ass commit\" --allow-empty\n```\n\nこの機能の使い方（便利なもの）としては以下のようなものが挙げられる:\n\n - 新たな機能や大きな変更を事前に通知する時\n - コード上に現れないような変更をプロジェクトに加えた時\n - リポジトリを利用して誰かと連絡を取りたい時\n - リポジトリへの最初のコミットをやり直しできるようにしたい時: `git commit -m \"init repo\" --allow-empty`.\n\n### Gitステータスのスタイリング\n普通に実行すると:\n\n```bash\n$ git status\n```\n\nこのように表示されるが:\n\n![git status](http://i.imgur.com/qjPyvXb.png)\n\n`-sb`を追加することによって:\n\n```bash\n$ git status -sb\n```\n\nこのように表示することもできる:\n\n![git status -sb](http://i.imgur.com/K0OY3nm.png)\n\n[*Gitの`status`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-status)\n\n### Gitログのスタイリング\n以下のように実行すると:\n\n```bash\n$ git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)\u003c%an\u003e%Creset' --abbrev-commit --date=relative\n```\n\nこのように表示される:\n\n![git log --all --graph --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)\u003c%an\u003e%Creset' --abbrev-commit --date=relative](http://i.imgur.com/58eOtkW.png)\n\nこの設定は[Palesz](http://stackoverflow.com/users/88355/palesz)が考えたものだ。\n\n*これは[後述の手順](#%E3%82%A8%E3%82%A4%E3%83%AA%E3%82%A2%E3%82%B9)に従ってエイリアスへ追加することもできる。*\n\n[*Gitの`log`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-log)\n\n### コミットログの検索\n指定した文字列を今までのコミット・メッセージから検索して、もっとも新しいものを表示することができる。\n\n```bash\n$ git show :/query\n```\n\n`query`を検索したい文字列（大文字と小文字を区別する）で置き換えると、最新のコミットがそのコミットにおける差分と同時に表示される。\n\n```bash\n$ git show :/typo\n```\n![git show :/query](http://i.imgur.com/icaGiNt.png)\n\n注: 終了するには`q`を押す。\n\n### Git Grep\nGit Grepは指定したパターンに一致する行の一覧を返してくれる。\n\n実行すると:\n\n```bash\n$ git grep aliases\n```\n\n*aliases*という文字を含むファイルを全て表示することだろう。\n\n![git grep aliases](http://i.imgur.com/DL2zpQ9.png)\n\n注: 終了するには`q`を押す。\n\n複数のフラグを組み合わせることで、より高度な検索を行うことができる。例えば:\n\n * `-e` 次のパラメーターをパターンとする (例: regex)\n * `--and`、`--or`と`--not` 複数のパターンを組み合わせる\n\n以下のようにして使う:\n\n```bash\n$ git grep -e pattern --and -e anotherpattern\n```\n\n[*Gitの`grep`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-grep)\n\n### マージ済みブランチ\n以下のように実行すると:\n\n```bash\n$ git branch --merged\n```\n\n現在のブランチに既にマージされたブランチの一覧が表示される。\n\n逆に:\n\n```bash\n$ git branch --no-merged\n```\n\nこうするとまだマージされていないブランチが表示されるだろう。\n\n[*Gitの`branch`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-branch)\n\n### FixupとAutosquash\nこれまでのコミット(HEADの直前でなくても構わない)、例えば`abcde`というチェックサムのコミットで何か問題を見つけた場合、以下の様なコマンドで問題の修正を行うことができる:\n\n```bash\n$ git commit --fixup=abcde\n$ git rebase abcde^ --autosquash -i\n```\n\n[*Gitの`commit`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-commit)\n[*Gitの`rebase`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-rebase)\n\n### ローカル・リポジトリを参照するウェブサーバー\nGitの`instaweb`コマンドを利用すると、自分の作業リポジトリを`gitweb`で参照することができる。このコマンドは`gitweb`とウェブサーバーをセットアップしてローカル・リポジトリをブラウザーで開けるようにする簡単なスクリプトだ。\n\n```bash\n$ git instaweb\n```\n\n以下のようなページが開かれる:\n\n![Git instaweb](http://i.imgur.com/Dxekmqc.png)\n\n[*Gitの`instaweb`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-instaweb)\n\n### Gitの設定\n`.gitconfig`とはあらゆる設定が書き込まれるファイルだ。\n\n#### エイリアス\nエイリアスはGitの呼び出し方を自分で好きなように定義できるヘルパー機能だ。例えば`git a`で`git add --all`を実行するようにすることができる。\n\nエイリアスを追加するには`~/.gitconfig`を開き、以下のような形式で記述していく:\n\n```\n[alias]\n  co = checkout\n  cm = commit\n  p = push\n  # Show verbose output about tags, branches or remotes\n  tags = tag -l\n  branches = branch -a\n  remotes = remote -v\n```\n\nまたはコマンドラインからも設定できる:\n\n```bash\n$ git config --global alias.new_alias git_function\n```\n\n例:\n\n```bash\n$ git config --global alias.cm commit\n```\n\n注: エイリアスが複数のコマンドからなる場合はクオートで括る必要がある:\n\n```bash\n$ git config --global alias.ac 'add -A . \u0026\u0026 commit'\n```\n\nおすすめの設定を挙げておこう:\n\n| エイリアス | コマンド | 設定方法 |\n| --- | --- | --- |\n| `git cm` | `git commit` | `git config --global alias.cm commit` |\n| `git co` | `git checkout` | `git config --global alias.co checkout` |\n| `git ac` | `git add . -A` `git commit` | `git config --global alias.ac '!git add -A \u0026\u0026 git commit'` |\n| `git st` | `git status -sb` | `git config --global alias.st 'status -sb'` |\n| `git tags` | `git tag -l` | `git config --global alias.tags 'tag -l'` |\n| `git branches` | `git branch -a` | `git config --global alias.branches 'branch -a'` |\n| `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\"` |\n| `git remotes` | `git remote -v` | `git config --global alias.remotes 'remote -v'` |\n| `git lg` | `git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)\u003c%an\u003e%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)\u003c%an\u003e%Creset' --abbrev-commit --\"` |\n\n#### コマンドの自動修正\n多分今は`git comit`とタイプした場合、以下のような出力を得ることだろう:\n\n```bash\n$ git comit -m \"Message\"\n# git: 'comit' is not a git command. See 'git --help'.\n\n# Did you mean this?\n#   commit\n```\n\nこれを`comit`とタイプした時に`commit`を実行させたい場合、自動修正を有効にすれば良い:\n\n```bash\n$ git config --global help.autocorrect 1\n```\n\nすると以下のような出力を得るようになるだろう:\n\n```bash\n$ git comit -m \"Message\"\n# WARNING: You called a Git command named 'comit', which does not exist.\n# Continuing under the assumption that you meant 'commit'\n# in 0.1 seconds automatically...\n```\n\n#### 色設定\nGitの出力をカラフルにするには以下のような設定を加えると良い:\n\n```bash\n$ git config --global color.ui 1\n```\n\n[*Gitの`config`コマンドについてもっと詳しく*](http://git-scm.com/docs/git-config)\n\n### Git情報\n| Title | Link |\n| ----- | ---- |\n| Official Git Site | http://git-scm.com/ |\n| Official Git Video Tutorials | http://git-scm.com/videos |\n| Code School Try Git | http://try.github.com/ |\n| Introductory Reference \u0026 Tutorial for Git | http://gitref.org/ |\n| Official Git Tutorial | http://git-scm.com/docs/gittutorial |\n| Everyday Git | http://git-scm.com/docs/everyday |\n| Git Immersion | http://gitimmersion.com/ |\n| Git for Computer Scientists | http://eagain.net/articles/git-for-computer-scientists/ |\n| Git Magic | http://www-cs-students.stanford.edu/~blynn/gitmagic/ |\n| GitHub Training Kit | http://training.github.com/kit |\n| Git Visualization Playground | http://onlywei.github.io/explain-git-with-d3/#freeplay |\n\n#### Git Books\n| Title | Link |\n| ----- | ---- |\n| Pragmatic Version Control Using Git | http://www.pragprog.com/titles/tsgit/pragmatic-version-control-using-git |\n| Pro Git | http://git-scm.com/book |\n| Git Internals PluralSight | https://github.com/pluralsight/git-internals-pdf |\n| Git in the Trenches | http://cbx33.github.com/gitt/ |\n| Version Control with Git | http://www.amazon.com/Version-Control-Git-collaborative-development/dp/1449316387 |\n| Pragmatic Guide to Git | http://www.pragprog.com/titles/pg_git/pragmatic-guide-to-git |\n| Git: Version Control for Everyone | http://www.packtpub.com/git-version-control-for-everyone/book |\n\n## 訳注\nこれは[GitHub Cheat Sheet](https://github.com/tiimgreen/github-cheat-sheet)の日本語訳である。\n","funding_links":["https://github.com/sponsors/tiimgreen"],"categories":["Uncategorized","Programming","Development Environment","Technical","▶️ Content","Others","Repository Hosting","General","Frameworks, runtime environments, editors","Tools","开发环境","Read more","Others (1002)","HarmonyOS","miscellaneous","Cheatsheets and Quick References","Index","Miscellaneous","Misc","GitHub","Dev","Live Site:   [searchAwesome](https://search-awesome.vercel.app/)","Github (Specific)","Version Control","其它Awesome项目","Resources for those already familiar with GitHub","后端开发框架及项目","工具","Other Lists","📋 Cheatsheets","other awesomes","github","awesome-list","Cheats sheets","Development:","CheatSheet😎","Git Commands and Terminology","[Git](https://git-scm.com/)","Useful links","Git","Awesome Lists","Themed Directories","Other awesome lists of interest"],"sub_categories":["Uncategorized","CheatSheets","Windows Manager","ramanihiteshc@gmail.com","GCP","Git","URL Shorteners","管理面板","TeX Lists","Linux \u0026 Git","Misc","Other awesome 'awesome' list","Web Clippers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiimgreen%2Fgithub-cheat-sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiimgreen%2Fgithub-cheat-sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiimgreen%2Fgithub-cheat-sheet/lists"}