This is a draft cheat sheet. It is a work in progress and is not finished yet.
Config
git config [--local | --global | --system] --list |
List config options and his values. |
git config [--local | --global | --system] <name> |
Get a config option value. |
git config [--local | --global | --system] <name> <value> |
Set a config option value. |
git config [--local | --global | --system] alias.<alias> '<command>' |
Create shortcut (alias) for a Git command. |
Init & Clone
git init [<directory>] |
Create empty Git repository in specified directory. |
git clone <repository-url> [<directory>] |
Clone (copy) repository located at <repository-url> onto specified directory. |
Status
git status |
List which files have been modified respect to the current commit, which will be part of the next commit and which will not. |
git ls-files |
Lists files in Index tree (staged) |
Add & Remove
git add <file> |
Add file to next commit (Index). |
git add -p [<file>] |
Add some of the changes in file to next commit (Index). |
git rm [-f] <file> |
Remove file from Working Directory and Index. |
git rm [-f] --cached <file> |
Remove file only from Index. |
|