Show Menu
Cheatography

Git Fundamentals Cheat Sheet (DRAFT) by

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 <re­pos­ito­ry-­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 <fi­le>
Add file to next commit (Index).
git add -p [<f­ile­>]
Add some of the changes in file to next commit (Index).
git rm [-f] <fi­le>
Remove file from Working Directory and Index.
git rm [-f] --cached <fi­le>
Remove file only from Index.