Jesse A. Green / notebook

Live demo: the DocCompiler guide library as a static, read-only snapshot (October 2026). No backend, no accounts, nothing to submit.

GitHub Cheat Sheet — Content Guide

Generated May 2026 from tiimgreen/github-cheat-sheet at 746af1b

AI-generated documentation. The library is checked by sampling (three repositories so far); this guide was not individually reviewed. Verify against the project before relying on it.

A community-maintained reference of "cool hidden and not so hidden features of Git and GitHub" — short tips, URL hacks, keyboard shortcuts, and git recipes — collected by Tim Green and contributors. The whole project is one Markdown file (README.md) with four community translations alongside it. There is nothing to install and no code to run; the deliverable is the prose itself.

This guide tells you what's inside the collection, the cleanest way to read it, what each section covers, and how to contribute. It mirrors the repository at commit 746af1b (2023-10-15) and quotes real anchors and file paths so you can jump from this guide straight into the source.

Note

The repository is shipped under the MIT License (LICENSE, © 2014 Tim Green). You can copy, adapt, or redistribute the cheat sheet provided you keep the copyright and license notice.


What's in This Collection

The repository's working tree is small and flat — eight files at the root, no subdirectories of content:

Path What's there
README.md The English cheat sheet itself (~43 KB). This is the primary artifact.
README.ja.md Japanese translation of the cheat sheet.
README.ko.md Korean translation (한국어).
README.zh-cn.md Simplified Chinese translation (简体中文).
README.zh-tw.md Traditional Chinese translation (正體中文).
CONTRIBUTING.md Style rules contributors must follow when adding a section.
LICENSE MIT license, © 2014 Tim Green.
.travis.yml CI configuration that link-checks every README on push.

The English README.md is divided into two top-level sections, with deeply nested subsections under each:

Section What's covered Source anchor
GitHub Browser-side features: URL tricks, keyboard shortcuts, issue and PR conveniences, Markdown rendering, contribution metadata files, octicons, the Student Developer Pack, repository templates. #github
Git Command-line features: branch shortcuts, commit hygiene, custom log/status formatting, search (git grep, git show :/query), aliases, auto-correct, color, and curated reading lists. #git

Tip

The README's own Table of Contents lists every subsection with anchor links — use it as the index when you want to jump to a specific tip rather than reading top-to-bottom.

The collection is a living snapshot: contributors have added tips and translations over time, but the core structure and most entries have been stable since the initial release.

Important

Last activity on the repository is the commit captured by this guide: 746af1b on 2023-10-15. Treat the tips as a snapshot of the GitHub UI and Git CLI as of that date. A handful of UI features (e.g. specific button labels, screenshot images hosted on third-party CDNs) may have shifted since.


How to Read / Use This

The cheat sheet is a reference, not a tutorial. It assumes you already use Git and GitHub day-to-day; each entry is a single self-contained tip with a code example and a link out to the canonical Git or GitHub documentation. There is no required reading order.

Suggested entry points:

Browse by topic

Open README.md, scroll the Table of Contents, and click into whatever subsection looks useful. Most entries are 5-15 lines plus a screenshot.

Search by keyword

Press t on the GitHub repo page (file finder) or use your browser's in-page search inside README.md. Section titles use exact feature names (e.g. "Stripspace", "Empty Commits", "Styled Git Log"), so a keyword search lands you directly on the relevant tip.

Read in another language

Pick the README that matches your locale: README.ja.md (日本語), README.ko.md (한국어), README.zh-cn.md (简体中文), README.zh-tw.md (正體中文). All four are linked from the top of README.md. The translations may lag the English version on the most recently added subsections; the English file is the canonical source.

Prerequisites: the GitHub-side tips assume a GitHub.com account and basic familiarity with the web UI (issues, pull requests, repo settings). The Git-side tips assume a working git install on your shell. No Git or GitHub Enterprise version is pinned in the README — tips that depend on a specific feature usually link to the announcement post.

Note

The repository's only operational machinery is .travis.yml. On every push, Travis CI installs the awesome_bot gem and runs it against README.md and each translation to flag broken links. That's why most outgoing links in the cheat sheet still resolve — they're checked on every contribution.


Section Walkthroughs

The README is organized as a Table of Contents followed by two long ## sections. The walkthroughs below mirror that structure and call out the most useful subsections inside each.

Section 1 — GitHub

The "GitHub" section collects browser-side tricks: URL parameters that change how diffs and blobs render, keyboard shortcuts inside the GitHub UI, conveniences for issues and pull requests, Markdown rendering features, and metadata files that change how a repository behaves on GitHub. Each subsection is a short standalone tip; you can read them in any order.

The subsections fall into roughly five groups:

URL hacks. Append-this-to-a-URL tricks that unlock hidden views without leaving the page. Examples: ?w=1 strips whitespace from a diff (Ignore Whitespace), ?ts=4 reflows tab indentation in blobs (Adjust Tab Space), ?author={user} filters commit history (Commit History by Author), #L52 and #L53-L60 highlight individual lines or ranges in a file view (Line Highlighting in Repositories), and .diff / .patch extensions on a pull-request URL return the raw patch (Diff or Patch of Pull Request). The Branch cluster — Compare all Branches, Comparing Branches, Compare Branches across Forked Repositories — is a deeper dive into the /compare/{range} URL form, including time-anchored ranges like master@{1.day.ago}...master.

Keyboard shortcuts. Keyboard Shortcuts covers the big ones (t for the file explorer, w for the branch selector, s to focus search, l to edit issue labels, y to canonicalize a blob URL to its commit-pinned form). Press ? on any GitHub page for the full list. Quick Quoting (highlight + r) inserts a block quote into the comment box.

Issues and pull requests. Closing Issues via Commit Messages lists the keywords (fix/fixes/fixed, close/closes/closed, resolve/resolves/resolved) that auto-close an issue when the commit lands on the default branch. Cross-Link Issues shows the {user}/{repo}#NUMBER shorthand. Locking Conversations and CI Status on Pull Requests round out the workflow tips. Filters is the densest entry: it walks through the issue/PR search syntax — is:issue label:activerecord, is:issue -label:activerecord, is:pr, is:merged, status:success. Revert a Pull Request covers the one-click revert button after merge.

Markdown and content rendering. Syntax Highlighting in Markdown Files explains how language tags after a fenced code block trigger Linguist-driven highlighting and points to the languages YAML file for the list of valid tags. Emojis covers the :name: syntax and lists the top-five most-used emojis on GitHub. Images/GIFs and its sub-entry Embedding Images in GitHub Wiki cover image syntax including the wiki-only [[ url | height = ... ]] form. Pasting Clipboard Image to Comments (Chrome only) explains the screenshot-to-comment paste flow. Task Lists, Relative Links, Metadata and Plugin Support for GitHub Pages, Viewing YAML Metadata in your Documents, Rendering Tabular Data, and Rendering PDF round out the Markdown story. The Diffs cluster — Rendered Prose Diffs, Diffable Maps, Expanding Context in Diffs, Rendering and diffing images — covers GitHub's content-aware diff renderers.

Repository metadata, profile, and resources. Quick Licensing describes the in-browser LICENSE and .gitignore template picker. The Contribution Guidelines cluster documents three special files GitHub recognizes — CONTRIBUTING, ISSUE_TEMPLATE, PULL_REQUEST_TEMPLATE — and where they can live (/ or .github/). Hub is a brief pointer to the hub CLI wrapper. Octicons, GitHub Student Developer Pack, SSH keys (https://github.com/{user}.keys), Profile Image (https://github.com/{user}.png), and Repository Templates cover account- and repo-level settings. GitHub Resources and its sub-table GitHub Talks are curated link tables — useful as a starting list, but they will age fastest of any section.

Tip

Several "URL hack" tips combine well. For example, link to a specific commit-pinned line range in a file (y to canonicalize the blob URL, then append #L53-L60), or share a whitespace-suppressed diff for a forked branch comparison (/compare/byroot:master...master?w=1).

Section 2 — Git

The "Git" section is for the command line. Tips here usually take the form one-liner you didn't know about, and most entries link out to the official git-scm.com reference for the underlying command. The subsections fall into three groups:

Branching, committing, and history. Remove All Deleted Files from the Working Tree (git rm $(git ls-files -d)), Previous Branch (git checkout -), Stripspace (whitespace cleanup via git stripspace), Checking out Pull Requests (the +refs/pull/*/head:refs/remotes/origin/pr/* refspec, both per-repo and globally), Empty Commits (git commit --allow-empty and four real-world use cases), Merged Branches (git branch --merged / --no-merged), and Fixup and Autosquash (git commit --fixup=abcde then git rebase abcde^ --autosquash -i).

Custom output and search. Styled Git Status (git status -sb), Styled Git Log (a long --pretty=format invocation that produces a colored, graph-decorated log — credited to Palesz on Stack Overflow), Git Query (git show :/query to find the most recent commit message containing a string), and Git Grep (multi-pattern matching with -e, --and, --or, --not).

Configuration: aliases, auto-correct, color. Web Server for Browsing Local Repositories (git instaweb) is a one-liner. The bigger entry is Git Configurations, which contains three subsections: Aliases (a curated table of aliases like git cm / git co / git ac / git st / git tags / git branches / git cleanup / git remotes / git lg, each with the exact git config --global alias.X 'Y' command to install it), Auto-Correct (git config --global help.autocorrect 15 for a 1.5-second corrected-command delay), and Color (git config --global color.ui 1).

Reading lists. Git Resources, Git Books, Git Videos, and Git Articles close out the file with curated link tables to official documentation, books, and conference talks.

Caution

Two entries quote shell pipelines verbatim — copy them carefully. The git cleanup alias (git branch --merged | grep -v '*' | xargs git branch -d) deletes any local branch that has been merged into the current one. Run git branch --merged first, alone, to confirm the list before installing the alias. Likewise, git rm $(git ls-files -d) from the Remove All Deleted Files from the Working Tree tip stages every deletion git knows about — fine in a clean working tree, surprising if you have multiple in-progress deletions you wanted to keep separate.

Note

A few links in the Git section point to articles or hosts that have shifted since 2023 (e.g. confreaks.tv, i.imgur.com, third-party blog posts). The repository's CI runs awesome_bot --allow-redirect, so a 301 still passes link-check; if a link 404s for you, treat it as link-rot from the upstream host, not a content error in the cheat sheet.


Contributing / Extending

Contributions follow the rules in CONTRIBUTING.md. The flow is the standard fork-and-PR five-step:

  • [ ] Fork the repository.
  • [ ] Add your section, following the styling rules below.
  • [ ] Commit your changes.
  • [ ] Push the commit to your fork.
  • [ ] Open a Pull Request against tiimgreen/github-cheat-sheet.

Styling rules (verbatim from CONTRIBUTING.md):

  • Use ### headers for new sections.
  • Also use ### for categories (groups of related sections) and #### for subcategories within a category.
  • Add a link to your new section/category in the Table of Contents. Use relative links (e.g. #new-section).
  • Include examples wherever possible — preferably GIFs.
  • Wrap command-line examples in a ```bash code block.
  • End every section with a Read more about ... link to the relevant page on git-scm.com/docs, help.github.com, or whichever source is canonical.
  • If your contribution is a translation, link your translation file relative to the README, immediately above the Table of Contents.

Important

Travis CI runs awesome_bot against README.md and each translation on every push (see .travis.yml). The check passes redirects (--allow-redirect) and duplicates (--allow-dupe), and a global wl= whitelist excludes a small set of legitimate-but-flagged URLs. Your PR must pass this check; if it fails, the CI log will name the broken link.


The README aggregates several curated link lists. The two largest are reproduced below for quick reference; both are also browsable in README.md.

GitHub-related (from GitHub Resources):

Git-related (selected highlights from Git Resources):

Title Link
Official Git Site http://git-scm.com/
Pro Git (book, free online) http://git-scm.com/book
Code School Try Git http://try.github.com/
Git Immersion http://gitimmersion.com/
Learn Git Branching (visual) http://pcottle.github.io/learnGitBranching/
Collection of .gitignore templates https://github.com/github/gitignore
git-extra-commands (Unixorn) https://github.com/unixorn/git-extra-commands

Original inspirations named in the README intro:

Warning

The git.io URL shortener documented in the cheat sheet's Git.io section — including the http://git.io/sheet shortlink for this repository — was retired by GitHub in April 2022 and no longer resolves. Share the cheat sheet using the full URL https://github.com/tiimgreen/github-cheat-sheet instead.