Git Cheat Sheet

GIT CHEAT SHEET

STAGE & SNAPSHOT

git status

Show modified files in working directory, staged for your next commit.

git add [file]

Add a file as it looks now to your next commit (stage).

git reset [file]

Unstage a file while retaining the changes in working directory.

git diff

Diff of what is changed but not staged.

git diff --staged

Diff of what is staged but not yet committed.

git commit -m “[descriptive message]”

Commit your staged content as a new commit snapshot.

SETUP

Configuring user information used across all local repositories

git config --global user.name “[firstname lastname]”

Set a name that is identifiable for credit when reviewing version history.

git config --global user.email “[valid-email]”

Set an email address that will be associated with each history marker.