Git Cheat Sheet
Create A Repository Work with change Sync with 'origin' (GitHub)
Initialize a local repo Stage specific files ready for commit Fetch latest changes from 'origin'
$ gi t i ni t $ gi t add <f i l e> $ gi t f et c h
Clone a repo (from GitHub, BitBucket) Stage all files Fetch & Merge latest changes from 'origin'
$ gi t c l one <r epo ur l > $ gi t add . $ gi t pul l
Inspect Repository Commit all staged files to local repo Push local changes to 'origin'
List uncommitted new/modified files $ gi t c ommi t - m ' mes s age' $ gi t pus h
$ gi t s t at us
Add and Commit all tracked files
Show unstaged changes $ gi t c ommi t - am ' mes s age'
$ gi t di f f
Unstage files, but keep changes
Show full change history $ gi t r es et <f i l e>
$ gi t l og $ gi t c hec k out <f i l e>
Show change history for a file Revert everything to last commit
commit -am
$ gi t l og - p <f i l ename> $ gi t r es et - - har d
add commit -m push <rem> <brch>
Working Staging Local Remote
Directory (index) Repository Repository
reset fetch
checkout <file>
reset <commit>
pull