Do you visit GitHub regularly? But you may not know the GitHub tips. Here are some tips for using GitHub.

## diff ignores Spaces

Some of the changes are just adding or subtracting Spaces, adding? W =1 is negligible.

View an author’s submission history to add to the URL? Author =username, for example:

https://github.com/rails/rails/commits/master?author=dhh

Copy the code

Compare the version

Compare branches using urls like the following:

https://github.com/rails/rails/compare/master... 4-1-stableCopy the code

You can also use the following format:

https://github.com/rails/rails/compare/master@{1.day.ago}... master https://github.com/rails/rails/compare/master@{2014-10-04}... masterCopy the code

To compare with a derived repository, prefix it with the name of the derived repository:

https://github.com/rails/rails/compare/byroot:master... masterCopy the code

Embed Gist in HTML

Gists is a Git-based code snippet service offered by GitHub. Gists page provides JavaScript code for Gists that can be embedded in other sites. But many sites don’t paste JavaScript, so you can attach.pibb to the Gist URL, get a pure HTML version, and then copy and paste the HTML source code to other sites. For example gist.github.com/tiimgreen/1…

Git. IO git. IO is a short url service for GitHub.

Do you want to Curl up with something?

$ curl -i http://git.io -F "url=https://github.com/..."HTTP/1.1 201 Created Location: http://git.io/abc123 $curl -I http://git.io/abc123 HTTP/1.1 302 Found Location: https://github.com/...Copy the code

You can even specify fields for short urls:


$ curl -i http://git.io -F "url=https://github.com/technoweenie" \
    -F "code=t"
HTTP/1.1 201 Created
Location: http://git.io/t
Copy the code

Gao Liangxing

For example, line 52 can be highlighted by adding #L52 to the URL. Or you can just click on the number of rows.

Multi-line highlighting is also supported. You can use a format like # l53-L60, or hold shift while clicking.

Github.com/rails/rails…

Quick reference

You can select other people’s comments and press R to copy them in the text box as quotes:

The task list

In a work order or merge request, you can use the task list syntax:

- [ ] Be awesome
- [ ] Do stuff
- [ ] Sleep

Copy the code

When checked, Markdown will be updated:

- [x] Be awesome
- [x] Do stuff
- [ ] Sleep
Copy the code

Merge the requested DIff and patch

You can add.diff and.patch after the URL to view merge requests in the corresponding mode:

github.com/tiimgreen/github-cheat-sheet/pull/15 https://github.com/tiimgreen/github-cheat-sheet/pull/15.diff https://github.com… The result is plain text:

diff --git a/README.md b/README.md
index 88fcf69..8614873 100644
--- a/README.md)
+++ b/README.md
@@ -28,6 +28,7 @@ All the hidden and not hidden features of Git and GitHub. This cheat sheet was i
 - [Merged Branches](#merged-branches)
 - [Quick Licensing](#quick-licensing)
 - [TODO Lists](#todo-lists)
+- [Relative Links](#relative-links)
 - [.gitconfig Recommendations](#gitconfig-recommendations)
     - [Aliases](#aliases)
     - [Auto-correct](#auto-correct)@@-38,6 +38,19 @@when they are clicked, they will be updatedin the pure Markdown:
 - [ ] Sleep

(...)
Copy the code