Git Cheat Sheet

A quick reference for the most commonly used Git commands and workflows.

Getting Started

Init repogit init
Clone repogit clone <url>
Configure usergit config --global user.name 'Name'
Configure emailgit config --global user.email 'email'

Daily Workflow

Statusgit status
Stage filegit add <file>
Stage allgit add -A or git add .
Commitgit commit -m 'message'
Commit with all stagedgit commit -am 'message'
Pushgit push origin <branch>
Pullgit pull origin <branch>

Branching

List branchesgit branch
Create branchgit branch <name>
Switch branchgit checkout <name>
Create & switchgit checkout -b <name>
Merge branchgit merge <branch>
Delete branchgit branch -d <name>