This cheat sheet summarizes everything useful commonly used Git and GitHub for quick reference.
- GUI: Github desktop
This is used to identify the commits you create:
$ git config --global user.name "[User Name]"
$ git config --global user.email "[e-mail]"
💡 Tip: Not necessary if you will use GitHub Desktop. Use
git config -l
to show all local git param.
Downloads a project and its entire version history
$ git clone [url]
Shows the status of changes as untracked, modified, or staged:
$ git status
List all remote and local branches:
$ git branch -a
Tells Git what files will be committed. It's necessary make it before of the $ git commit
command:
$ git add [file-1] [file-2] [...] [file-n]
Add changes from all tracked and untracked file (new file, modified file and deleted file):
$ git add -A
💡 Tip: Use this in almost all cases. Find out more.
Add changes from only tracked files (modified file and deleted file):
$ git add -u
💡 Tip: This is useful when the new files are temporary and still not are in .gitignore. For example: log files.
Record changes to the local repository:
$ git commit -m "[summary message]" -m "[description message]"
💡 Tip: You can add many description messages, for example:
$ git commit -m "Summary" -m "msg 1" -m "msg 2" -m "msg 3"
, etc.
Unstages the file, but preserve its contents:
$ git reset <file>
💡 Tip: use only
$ git reset
for reset all files.
Discard changes in working directory
$ git checkout <file>
- Git push results in “Authentication Failed”:
When you're using two-factor authentication you a personal access token is required to authenticate to GitHub over HTTPS with Git on the command line or the API. Find out more.
- How to stop Google indexing my Github repository
The https://github.com/robots.txt file of GitHub allows the indexing of the blobs in the 'master' branch, but restricts all other branches. So if you don't have a 'master' branch, Google is not supposed to index your pages. Find out more: 1, 2, 3.
- Gitmoji - Emoji guide for commit messages
- Emoji Log - Emoji Git commit messages spec standard
- Angula commit message guideline
- How to get more out of your Git commit message
- Shields - Dynamic badges for open source projects
- Read The Docs - Documentation for the open source community
- CodeCov - Code Coverage
- GitHub Searching Code
- A curated list of GitHub's awesomeness
- GitHub Mastering Markdown
- Emoji Cheat Sheet
- Full Emoji List
- Nock Project - Some idea for GitHub issues template
List of alternatives source/git code management