Cool (and sometimes) hidden features of Git and GitHub

This repo has so much good stuff. Some favourites:

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


To view all commits on a repo by author add ?author={user} to the URL. https://github.com/rails/rails/commits/master?author=dhh


Compare all Branches to Another Branch https://github.com/{user}/{repo}/branches


Git.io is a simple URL shortener for GitHub.


When on a repository page:

Pressing ? -> help

Pressing t -> file explorer.

Pressing w -> the branch selector.

Pressing s -> select the Command Bar.

Pressing l -> edit labels on existing Issues.

Pressing y -> go to canonical URL


$ git commit -m "Fix screwup, fixes #12"

This closes the issue and references the closing commit.


When on a comment thread and you want to quote something someone previously said, highlight the text and press r, this will copy it into your text box in the block-quote format.


In Issues and Pull requests check boxes can be added with the following syntax (notice the space):

- [ ] Prepare dinner
  - [ ] Research recipe
  - [ ] Buy ingredients
  - [ ] Cook recipe
- [ ] Sleep

When the rendered list items are clicked, they will be updated in the pure Markdown:


Git Stripspace:

  • Strips trailing whitespace
  • Collapses newlines
  • Adds newline to end of file

A file must be passed when calling the command, e.g.:

$ git stripspace < README.md


A Git query allows you to search all your previous commit messages and find the most recent one matching the query.

$ git show :/typo