mirror of
https://github.com/tiimgreen/github-cheat-sheet.git
synced 2025-08-10 18:04:10 +02:00
Add links to docs
This commit is contained in:
40
README.md
40
README.md
@@ -38,6 +38,8 @@ All the hidden and not hidden features of Git and GitHub. This cheat sheet was i
|
||||
|
||||
Adding `?w=1` to any diff URL will remove any changes only in whitespace, enabling you to see only that code that has changed.
|
||||
|
||||
[*Read more about GitHub secrets.*](https://github.com/blog/967-github-secrets)
|
||||
|
||||
## Cloning a Repo
|
||||
|
||||
When cloning a repo the `.git` can be left off the end.
|
||||
@@ -46,6 +48,8 @@ When cloning a repo the `.git` can be left off the end.
|
||||
$ git clone https://github.com/tiimgreen/github-cheat-sheet
|
||||
```
|
||||
|
||||
[*Read more about the Git `clone` command.*](http://git-scm.com/docs/git-clone)
|
||||
|
||||
## Hub - Git Wrapper
|
||||
|
||||
[Hub](https://github.com/github/hub) is a command line git wrapper that gives extra features and commands that make working with GitHub easier.
|
||||
@@ -83,12 +87,16 @@ $ git checkout -
|
||||
# Switched to branch 'master'
|
||||
```
|
||||
|
||||
[*Read more about Git branching.*](http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)
|
||||
|
||||
## git.io
|
||||
|
||||
[git.io](http://git.io) is a simple URL shortener for GitHub.
|
||||
|
||||
[http://git.io/wO0xUg](http://git.io/wO0xUg)
|
||||
|
||||
[*Read more about Git.io.*](https://github.com/blog/985-git-io-github-url-shortener)
|
||||
|
||||
## Gists
|
||||
|
||||
[Gists](https://gist.github.com/) are an easy way to work with small bits of code without creating a fully fledged repo.
|
||||
@@ -100,6 +108,8 @@ $ git clone https://gist.github.com/tiimgreen/10545817
|
||||
|
||||

|
||||
|
||||
[*Read more about creating gists.*](https://help.github.com/articles/creating-gists)
|
||||
|
||||
## Keyboard Shortcuts
|
||||
|
||||
When on a repo page keyboard shortcuts allow you to navigate easily.
|
||||
@@ -116,6 +126,8 @@ Pressing `y` __when looking at a file__ (e.g. `https://github.com/tiimgreen/gith
|
||||
|
||||
To see all of the shortcuts for the current page press `?`.
|
||||
|
||||
[*Read more about using the Command Bar.*](https://help.github.com/articles/using-the-command-bar)
|
||||
|
||||
## Closing Issues with Commits
|
||||
|
||||
If a particular commit fixes an issue, any of the keywords `fix/fixes/fixed` or `close/closes/closed`, followed by the issue number, will close the issue once it is committed to the master branch.
|
||||
@@ -128,6 +140,8 @@ This closes the issue and references the closing commit.
|
||||
|
||||

|
||||
|
||||
[*Read more about closing issues via commit messages.*](https://help.github.com/articles/closing-issues-via-commit-messages)
|
||||
|
||||
## Checking out Pull Requests
|
||||
|
||||
If you want to check out pull request locally, you can fetch it using that command:
|
||||
@@ -170,6 +184,8 @@ and even fetch them automatically, if you add corresponding lines in your .git/c
|
||||
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
|
||||
```
|
||||
|
||||
[*Read more about checking out pull requests locally.*](https://help.github.com/articles/checking-out-pull-requests-locally)
|
||||
|
||||
## Cross-link Issues
|
||||
|
||||
If you want to link to another issue in the same repo, simple type hash `#` then the issue number, it will be auto-linked.
|
||||
@@ -198,6 +214,8 @@ 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)
|
||||
|
||||
## Commit History by Author
|
||||
|
||||
To view all commits on a repo by author add `?author=username` to the URL.
|
||||
@@ -206,6 +224,8 @@ To view all commits on a repo by author add `?author=username` to the URL.
|
||||
https://github.com/rails/rails/commits/master?author=dhh
|
||||
```
|
||||
|
||||
[*Read more about the differences between commits views.*](https://help.github.com/articles/differences-between-commit-views)
|
||||
|
||||
## Empty Commits
|
||||
|
||||
Commits can be pushed with no code changes by adding `--allow-empty`
|
||||
@@ -238,6 +258,8 @@ https://github.com/rails/rails/compare/master@{2014-10-04}...master
|
||||
```
|
||||
which allows you to see the difference on the master branch up a set time ago or a specified date.
|
||||
|
||||
[*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:
|
||||
@@ -307,6 +329,8 @@ When on a comment thread and you want to quote something someone previously said
|
||||
|
||||

|
||||
|
||||
[*Read more about quick quoting.*](https://github.com/blog/1399-quick-quotes)
|
||||
|
||||
## Styled Git Status
|
||||
|
||||
```bash
|
||||
@@ -323,6 +347,8 @@ $ git status -sb
|
||||
|
||||

|
||||
|
||||
[*Read more about the Git `status` command.*](http://git-scm.com/docs/git-status)
|
||||
|
||||
## Styled Git Log
|
||||
|
||||
```bash
|
||||
@@ -333,6 +359,8 @@ $ git log --all --graph --decorate --oneline --abbrev-commit
|
||||
|
||||
NOTE: This can be added into an Alias (shorter command) using the instructions [here](https://github.com/tiimgreen/github-cheat-sheet#aliases)
|
||||
|
||||
[*Read more about the Git `log` command.*](http://git-scm.com/docs/git-log)
|
||||
|
||||
## Git Query
|
||||
|
||||
A git query allows you to search all your previous commit messages and finds the most recent one matching the query.
|
||||
@@ -366,6 +394,8 @@ $ git branch --no-merged
|
||||
|
||||
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)
|
||||
|
||||
## Quick Licensing
|
||||
|
||||
When creating a repo GitHub gives you the options of adding in a pre-made license:
|
||||
@@ -378,6 +408,8 @@ You can also add them to existing repos by creating a new file through the web i
|
||||
|
||||
Also works for `.gitignore`.
|
||||
|
||||
[*Read more about open source licensing.*](https://help.github.com/articles/open-source-licensing)
|
||||
|
||||
## TODO Lists
|
||||
|
||||
In Issues and Pull requests check boxes can be added with the following syntax (notice the space):
|
||||
@@ -397,9 +429,11 @@ When they are clicked, they will be updated in the pure Markdown:
|
||||
- [ ] Sleep
|
||||
```
|
||||
|
||||
[*Read more about task lists.*](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments)
|
||||
|
||||
## Relative Links
|
||||
|
||||
[Relative links](https://help.github.com/articles/relative-links-in-readmes) are recommended in your Markdown files when linking to internal content.
|
||||
Relative links are recommended in your Markdown files when linking to internal content.
|
||||
|
||||
```markdown
|
||||
[Link to a header](#awesome-section)
|
||||
@@ -410,6 +444,8 @@ When they are clicked, they will be updated in the pure Markdown:
|
||||
Absolute links have to be updated whenever the URL changes (e.g. repo 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)
|
||||
|
||||
## .gitconfig Recommendations
|
||||
|
||||
Your `.gitconfig` is the file that contains all your preferences.
|
||||
@@ -492,6 +528,8 @@ To add more colour to your git command line:
|
||||
$ git config --global color.ui 1
|
||||
```
|
||||
|
||||
[*Read more about the Git `config` command.*](http://git-scm.com/docs/git-config)
|
||||
|
||||
# Sharing
|
||||
|
||||
Share on [Twitter](https://twitter.com/intent/tweet?source=webclient&text=http%3A%2F%2Fgithub.com%2Ftiimgreen%2Fgithub-cheat-sheet%20-%20GitHub%20Cheat%20Sheet)
|
||||
|
Reference in New Issue
Block a user